On Thu, 2026-01-29 at 16:04:04 +0100, Jakub Jelinek wrote: > On Thu, Jan 29, 2026 at 02:31:12PM +0100, Michal Jires wrote: > > Tested on x86_64-pc-linux-gnu. > > > > PR testsuite/123559 > > > > gcc/c/ChangeLog: > > > > * c-decl.cc (c_write_global_declarations_1): Check asm symbols. > > * c-typeck.cc (build_asm_expr): Mark asm symbols. > > > > gcc/ChangeLog: > > > > * cgraphunit.cc (check_global_declaration): Check asm symbols. > > * tree-core.h (struct tree_decl_with_vis): Add defined_in_asm. > > * tree.h (DECL_DEFINED_IN_ASM): New. > > > > gcc/cp/ChangeLog: > > > > * decl.cc (wrapup_namespace_globals): Check asm symbols. > > * semantics.cc (finish_asm_stmt): Mark asm symbols. > > > > gcc/testsuite/ChangeLog: > > > > * c-c++-common/toplevel-extended-asm-1.c: New test. > > Can't you just > else if (TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL) > suppress_warning (TREE_OPERAND (t, 0), OPT_Wunused_function); > in both FEs?
That would work for C++ frontend, but the C frontend does not check suppresed warnings for "used but never defined". Which I presume would change warnings with some inputs. But if that would not be an issue, your solutions seems better. Michal > > Jakub >
