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]

Fix -undef option handling


My patch <http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00669.html>
broke building glibc because it taught the .opt machinery about the -u
option, as a driver option, causing the driver to treat "-undef" as
"-u ndef", so breaking the -undef option and causing the glibc build
process, when preprocessing shlib-versions files, to expand "linux" to
"1".  (In cases where an option on the command line matches multiple
.opt entries, one with the language matching is preferred to one where
it does not match.)

This patch fixes this by adding a "Driver" entry for the -undef
option.  Bootstrapped with no regressions on
x86_64-unknown-linux-gnu.  OK to commit?

2010-09-24  Joseph Myers  <joseph@codesourcery.com>

	* common.opt (undef): New.

testsuite:
2010-09-24  Joseph Myers  <joseph@codesourcery.com>

	* gcc.dg/cpp/undef-opt-1.c: New test.

Index: gcc/testsuite/gcc.dg/cpp/undef-opt-1.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/undef-opt-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/undef-opt-1.c	(revision 0)
@@ -0,0 +1,8 @@
+/* Test -undef.  A bug in its handling broke glibc builds because
+   "linux" was wrongly defined.  */
+/* { dg-do preprocess } */
+/* { dg-options "-undef" } */
+
+#ifdef linux
+#error -undef broken
+#endif
Index: gcc/common.opt
===================================================================
--- gcc/common.opt	(revision 164532)
+++ gcc/common.opt	(working copy)
@@ -1924,6 +1924,10 @@
 u
 Driver Joined Separate
 
+undef
+Driver
+; C option, but driver must not handle as "-u ndef".
+
 v
 Driver
 

-- 
Joseph S. Myers
joseph@codesourcery.com


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