On Mon, 30 Oct 2023, Barnabás Pőcze wrote: > Hi > > > 2023. október 30., hétfő 19:01 keltezéssel, Joseph Myers írta: > > > On Sat, 28 Oct 2023, Barnabás Pőcze wrote: > > > > > An external declaration following an inline definition is not redundant > > > because it forces the compiler to emit an external definition for the > > > function. > > > That is, > > > > > > inline void f(void) { } > > > [extern] void f(void); > > > > > > should not trigger the > > > > > > redundant redeclaration of ... > > > > > > warning. > > > > > > This should add a testcase to the testsuite (that fails before and passes > > after the front-end change is made). > > I did not want to commit more effort until I have some feedback. > I will most certainly add a test case if it turns out that the change > seems reasonable and has a chance of being accepted.
I agree that such a declaration is not redundant, and indeed serves a useful purpose, and so it's appropriate to avoid the warning in that case. Maybe also edit the documentation in invoke.texi to mention this case as not being diagnosed because not redundant. Hopefully cases such as inline void f(void) { } void f(void); void f(void); do warn for the final declaration, because that one *is* redundant. Similarly, the changes should not affect warnings in the -fgnu89-inline case, because then a subsequent extern declaration has no effect on a prior inline definition. Tests should include all these variations. -- Joseph S. Myers jos...@codesourcery.com