https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102846
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <[email protected]>: https://gcc.gnu.org/g:00956e55dd2fbbee751e953ca2f6b8a87151f85b commit r16-7121-g00956e55dd2fbbee751e953ca2f6b8a87151f85b Author: Andrew Pinski <[email protected]> Date: Tue Oct 14 17:50:13 2025 -0700 C/C++: Better notification if misused a function like macro [PR102846] Currently if assert is misused, e.g. like passing to a function like a function pointer, GCC suggests to include assert.h/cassert. But since it is already included that is just a bogus suggestion. Instead we should see if a function-like macro is that same name (in the case of assert it will be), and inform the user that it is being mis-used. PR c++/102846 PR c/102846 gcc/c-family/ChangeLog: * known-headers.cc (macro_like_function_used::macro_like_function_used): New. (macro_like_function_used::~macro_like_function_used): New. * known-headers.h (class macro_like_function_used): New class. gcc/c/ChangeLog: * c-decl.cc (lookup_name_fuzzy): Lookup function-like macro and notify of misuse there. gcc/cp/ChangeLog: * name-lookup.cc (lookup_name_fuzzy): Lookup function-like macro and notify of misuse there. gcc/testsuite/ChangeLog: * c-c++-common/function-like-macro-1.c: New test. * c-c++-common/function-like-macro-2.c: New test. Signed-off-by: Andrew Pinski <[email protected]>
