Quuxplusone added inline comments.
================ Comment at: clang/docs/ReleaseNotes.rst:79-80 +- ``-Wstack-usage=<byte-size>`` warn if stack usage of user functions might + exceed <byte-size>. + ---------------- Does this mean: - Warn if the size of any single function's stack frame (including temporaries and local variables, but not parameters or return addresses) exceeds <byte-size>. - Warn if the size of any single function's stack frame (including parameters and return addresses) exceeds <byte-size>. - Warn if the total stack usage of the longest visible call chain in this translation unit might exceed <byte-size>. ? ================ Comment at: clang/test/Frontend/backend-stack-usage-diagnostic.c:19-23 +// WARN: warning: stack frame size of {{[0-9]+}} bytes in function 'test_square' +// IGNORE-NOT: stack frame size of {{[0-9]+}} bytes in function 'test_square' +int test_square(int num) { + return num * num; +} ---------------- This function has no "stack frame" in the usual sense of the word, because it's just ``` movl %edi, %eax imull %edi, %eax ret ``` So am I correct to infer that the `-Wstack-usage=` option includes the size of the return address in its computations? So the stack usage of this function would be computed as "8 bytes" because the `callq` instruction pushes 8 bytes on the stack? This seems eminently reasonable to me, but non-obvious, and should get some user-facing documentation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102782/new/ https://reviews.llvm.org/D102782 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits