[all-commits] [llvm/llvm-project] a633a3: Diagnose problematic uses of constructor/destructo...
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Wed Oct 11 05:14:58 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a633a3761fcbd0799426cbf5fbd7794961080e43
https://github.com/llvm/llvm-project/commit/a633a3761fcbd0799426cbf5fbd7794961080e43
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2023-10-11 (Wed, 11 Oct 2023)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/AttrDocs.td
M clang/include/clang/Basic/DiagnosticGroups.td
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaDeclAttr.cpp
M clang/test/CodeGen/PowerPC/aix-destructor-attribute.c
M clang/test/CodeGenCXX/aix-destructor-attribute.cpp
A clang/test/Sema/constructor-attribute-diag-group.c
M clang/test/Sema/constructor-attribute.c
M compiler-rt/CMakeLists.txt
M compiler-rt/cmake/config-ix.cmake
M compiler-rt/test/profile/Posix/gcov-destructor.c
M compiler-rt/test/ubsan/TestCases/Misc/Linux/sigaction.cpp
Log Message:
-----------
Diagnose problematic uses of constructor/destructor attribute (#67673)
Functions with these attributes will be automatically called before
main() or after main() exits gracefully. In glibc environments, the
constructor function is passed the same arguments as main(), so that
signature is allowed. In all other environments, we require the function
to accept no arguments and either return `void` or `int`. The functions
must use the C calling convention. In C++ language modes, the functions
cannot be a nonstatic member function, or a consteval function.
Additionally, these reuse the same priority logic as the init_priority
attribute which explicitly reserved priorty values <= 100 or > 65535. So
we now diagnose use of reserved priorities the same as we do for the
init_priority attribute, but we downgrade the error to be a warning
which defaults to an error to ease use for implementers like compiler-rt
or libc.
This relands b4435104ca3904529723b0673cc0f624cf8c54e6 with fixes.
More information about the All-commits
mailing list