http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46097
--- Comment #31 from Ian Lance Taylor <ian at airs dot com> 2010-10-22 23:55:44 UTC --- As I understand this, this is a request for a warning for any definition of a global variable. Is that correct? Such a warning certainly can not be part of -Wall or -Wextra. Global variables are part of the C/C++ language and it is not incorrect for code to use them. While global variables are the more common source of problems here, you can also have problems due to multiple functions with the same name. The proposed option will not help with that case. For example, you will get multiple functions if you have two different C++ classes with the same name, and each defines a method with the same name (perhaps the constructor or destructor), and the method is declared as inline (perhaps because it was defined within the class definition), and the methods are called, and the calls are not inlined (perhaps because the code was compiled without optimization). So I do not think that an option warning about global variables is a complete solution for the problem you are describing. I also think that such a warning would be highly special purpose. Unless we have a clear sign of demand for the proposed option, I would prefer to see it implemented as a plugin rather than as a general compiler option.