https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93804
Bug ID: 93804 Summary: exempt extern "C" headers from -Wredundant-tags Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- As noted in https://gcc.gnu.org/ml/gcc-patches/2020-02/msg01016.html, -Wredundant-tags is not useful for declarations in shared C/C++ headers that cannot be changed to drop the tag. For example: $ cat t.C && gcc -S -Wredundant-tags -Wsystem-headers t.C #include <time.h> In file included from /usr/include/bits/time.h:73, from /usr/include/time.h:33, from t.C:1: /usr/include/bits/timex.h:37:3: warning: redundant class-key ‘struct’ in reference to ‘struct timeval’ [-Wredundant-tags] 37 | struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ | ^~~~~~ | ------ In file included from /usr/include/time.h:33, from t.C:1: /usr/include/bits/time.h:78:51: warning: redundant class-key ‘struct’ in reference to ‘struct timex’ [-Wredundant-tags] 78 | extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW; | ^~~~~~ | ------ In file included from /usr/include/time.h:48, from t.C:1: /usr/include/bits/types/struct_itimerspec.h:10:5: warning: redundant class-key ‘struct’ in reference to ‘struct timespec’ [-Wredundant-tags] 10 | struct timespec it_interval; | ^~~~~~ | ------ /usr/include/bits/types/struct_itimerspec.h:11:5: warning: redundant class-key ‘struct’ in reference to ‘struct timespec’ [-Wredundant-tags] 11 | struct timespec it_value; | ^~~~~~ | ------ ...