[PATCH] D75056: [Driver] Default to -fno-common for all targets

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 26 12:57:13 PST 2020


jyknight added a comment.

Are there any tests remaining that check that with -fcommon, IR generation creates "common" variables, now that all these tests have been modified? If there are not, one should be added.



================
Comment at: clang/docs/ClangCommandLineReference.rst:1311
+Place definitions of variables with no storage class and no initializer
+(tentative definitions) in a common block, or generate individual
+zero-initialized definitions (default -fno-common).
----------------
Use "instead of generating" instead of "or generate".

Mention "This option has no effect in C++ mode."


================
Comment at: clang/docs/ReleaseNotes.rst:87
 
+- -fno-common has been enabled as the default for all targets.
 
----------------
Might be nice to expand upon this somewhat, to give users a clue what it means to them.

E.g. 

Therefore, C code which uses multiple definitions of a global variable will trigger a multiple-definition linker errors. Generally this occurs when a variable in a header file neglects to use the "extern" keyword on the declaration. The previous behavior can be restored by specifying -fcommon.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75056/new/

https://reviews.llvm.org/D75056





More information about the cfe-commits mailing list