This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove pointless -fPIC warning on Windows platforms


There are plenty of targets that do not require -fPIC because they always
generate position independent code, but none of them feels the need to
complain with the user about an unnecessary but perfectly valid option,
on each and every .c->.o rule, and without a way to disable it.

Adding insult to injury, the warning is also wrong in 3 cases out of four.
For 32-bit, warning may make a small amount of sense because there is
simply no such thing as PIC code (Windows just uses a "preferred base
address" for DLLs); but then the text is wrong.

For 64-bit, -fpic does not warn, but "all code is position independent"
would apply just as well!

As a summary, googling for the warning text finds exactly two categories
of people: those that are annoyed by the message because they want to
use -Werror (this includes me), and those that suggest replacing -fPIC
with -fpic.  Just zap it.

Paolo

	* config/i386/cygming.h (SUBTARGET_OVERRIDE_OPTIONS): Do
	not warn.

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index fda59fb..71506ec 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -198,20 +198,7 @@ along with GCC; see the file COPYING3.  If not see
 #undef  SUBTARGET_OVERRIDE_OPTIONS
 #define SUBTARGET_OVERRIDE_OPTIONS					\
 do {									\
-  if (TARGET_64BIT && flag_pic != 1)					\
-    {									\
-      if (flag_pic > 1)							\
-        warning (0,							\
-	         "-fPIC ignored for target (all code is position independent)"\
-                 );                         				\
-      flag_pic = 1;							\
-    }									\
-  else if (!TARGET_64BIT && flag_pic)					\
-    {									\
-      warning (0, "-f%s ignored for target (all code is position independent)",\
-	       (flag_pic > 1) ? "PIC" : "pic");				\
-      flag_pic = 0;							\
-    }									\
+  flag_pic = TARGET_64BIT ? 1 : 0;                                      \
 } while (0)
 
 /* Define this macro if references to a symbol must be treated


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]