https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102953
--- Comment #11 from Andrew Cooper <andrew.cooper3 at citrix dot com> --- (In reply to H.J. Lu from comment #10) > (In reply to Andrew Cooper from comment #8) > > Actually, there is a (possibly pre-existing) diagnostics issue: > > > > $ cat proto.c > > static void __attribute__((cf_check)) foo(void); > > static void __attribute__((unused)) foo(void) > > { > > } > > void (*ptr)(void) = foo; > > > > $ gcc -Wall -Os -fcf-protection=branch -mmanual-endbr > > -fcf-check-attribute=no -c proto.c -o proto.o > > proto.c:2:37: error: conflicting types for 'foo'; have 'void(void)' > > 2 | static void __attribute__((unused)) foo(void) > > | ^~~ > > proto.c:1:39: note: previous declaration of 'foo' with type 'void(void)' > > 1 | static void __attribute__((cf_check)) foo(void); > > | ^~~ > > > > > > The diagnostic complaining that the forward declaration doesn't match the > > definition gives 'void(void)' as the type in both cases, leaving out the > > fact that they differ by cf_check-ness. > > Please try the v2 patch. I appear to get no diagnostic at all now. This seems like a regression from v1. There should be a diagnostic, but it ought to include cf_check in the type it prints.