Wiki says:
The
extern
keyword means \"declare without defining\". In other words, it is a way to explicitly declare a variable, or to f
This code is perfectly valid.
But any compiler is free to issue additional (informative or not) diagnostics:
(C99, 5.1.1.3p1 fn 8) "Of course, an implementation is free to produce any number of diagnostics as long as a valid program is still correctly translated."
What a compiler cannot do is not emitting a diagnostic when there is a constraint or syntax violation.
EDIT:
As devnull put in the OP question comments, Joseph Myers from gcc
team explains in a bug report questioning this diagnostic:
"This is a coding style warning - the code is valid, but extremely unidiomatic for C since "extern" is generally expected to mean that the declaration is not providing a definition of the object."