[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-09-11 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. hazohelet marked an inline comment as done. Closed by commit rG72f6abb9bca6: [clang][Sema] Fix format size estimators handling of %o, %x, %X with… (authored by

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-09-09 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet marked 4 inline comments as done. hazohelet added a comment. Thanks for the review! Comment at: clang/docs/ReleaseNotes.rst:125 * ``-Woverriding-t-option`` is renamed to ``-Woverriding-option``. * ``-Winterrupt-service-routine`` is renamed to

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-09-08 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers accepted this revision. nickdesaulniers added a comment. This revision is now accepted and ready to land. Thanks for the patch! Comment at: clang/test/Sema/warn-fortify-source.c:100-102 + __builtin_snprintf(buf, 2, "%#x", n); + __builtin_snprintf(buf, 2,

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-09-08 Thread serge via Phabricator via cfe-commits
serge-sans-paille added inline comments. Comment at: clang/docs/ReleaseNotes.rst:125 * ``-Woverriding-t-option`` is renamed to ``-Woverriding-option``. * ``-Winterrupt-service-routine`` is renamed to ``-Wexcessive-regsave`` as a generalization ??

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-09-08 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Ping CHANGES SINCE LAST ACTION https://reviews.llvm.org/D159138/new/ https://reviews.llvm.org/D159138 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-08-31 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: clang/test/Sema/warn-fortify-source.c:100-102 + __builtin_snprintf(buf, 2, "%#x", n); + __builtin_snprintf(buf, 2, "%#X", n); + __builtin_snprintf(buf, 2, "%#o", n); nickdesaulniers wrote: > Note that GCC

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-08-31 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: clang/test/Sema/warn-fortify-source.c:100-102 + __builtin_snprintf(buf, 2, "%#x", n); + __builtin_snprintf(buf, 2, "%#X", n); + __builtin_snprintf(buf, 2, "%#o", n); Note that GCC -Wformat-truncation can warn

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-08-31 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D159138#4628858 , @nickdesaulniers wrote: > Mind adding tests for `%#X` and `%#o` as well, since you're changing the > behavior of those, too? > > I think it would also be good to have explicit tests for `%o` and `%b`

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-08-31 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 555043. hazohelet marked an inline comment as done. hazohelet added a comment. Added `%X` and `%o` tests, which are also affected CHANGES SINCE LAST ACTION https://reviews.llvm.org/D159138/new/ https://reviews.llvm.org/D159138 Files:

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-08-30 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Mind adding tests for `%#X` and `%#o` as well, since you're changing the behavior of those, too? I think it would also be good to have explicit tests for `%o` and `%b` where the value being printed was and was not `0`. IIUC, we cannot diagnose those (unless a

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-08-30 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet marked an inline comment as done. hazohelet added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:966 +// size. e.g.(("%#3x", 0xf) is "0xf") + +// If the result is zero, o, b, x, X adds nothing. serge-sans-paille wrote: >

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-08-30 Thread serge via Phabricator via cfe-commits
serge-sans-paille added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:966 +// size. e.g.(("%#3x", 0xf) is "0xf") + +// If the result is zero, o, b, x, X adds nothing. Then couldn't we increase the Size if the `FieldWidth` is

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-08-29 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added reviewers: aaron.ballman, nickdesaulniers, serge-sans-paille. Herald added a project: All. hazohelet requested review of this revision. Herald added a project: clang. The wrong handling of %x specifier with alternative form causes a false positive