Patchwork fixinclude patch for fenv.h on Ubuntu

login
register
mail settings
Submitter Bruce Korb
Date Dec. 7, 2013, 11:02 p.m.
Message ID <52A3A913.6010205@gnu.org>
Download mbox | patch
Permalink /patch/298741/
State New
Headers show

Comments

Bruce Korb - Dec. 7, 2013, 11:02 p.m.
This patch fixes Ian's issue, and several similar patterns:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00681.html

$ make check
autogen -T ../.././fixincludes/check.tpl ../.././fixincludes/inclhack.def
/bin/sh ./check.sh ../.././fixincludes/tests/base
Fixed:  testing.h
[[...]]
Fixed:  unistd.h

All fixinclude tests pass
/u/gnu/proj/gcc-svn-bld/build-x86_64-unknown-linux-gnu/fixincludes

Full build for x86-64 in progress.  Patch submission likely tomorrow.

Patch

Index: fixincludes/ChangeLog
===================================================================
--- fixincludes/ChangeLog	(revision 204533)
+++ fixincludes/ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2013-09-20  Bruce Korb  <bkorb@gnu.org>
+
+	* inclhack.def: many of the headers found under "bits/" are
+	often stashed under architecture directories.  Apply fixes
+	to those, too.  Also, re-ordered a couple of misordered fixes.
+
 2013-09-20  Alan Modra  <amodra@gmail.com>
 
 	* configure: Regenerate.
Index: fixincludes/fixincl.x
===================================================================
--- fixincludes/fixincl.x	(revision 204533)
+++ fixincludes/fixincl.x	(working copy)
[[generated]]

Index: fixincludes/inclhack.def
===================================================================
--- fixincludes/inclhack.def	(revision 204533)
+++ fixincludes/inclhack.def	(working copy)
@@ -1140,6 +1140,20 @@ 
 };
 
 /*
+ *  Old Linux kernel's <compiler.h> header breaks Traditional CPP
+ */
+fix = {
+    hackname  = complier_h_tradcpp;
+    files     = linux/compiler.h;
+
+    select    = "#define __builtin_warning\\(x, y\\.\\.\\.\\) \\(1\\)";
+    c_fix     = format;
+    c_fix_arg = "/* __builtin_warning(x, y...) is obsolete */";
+
+    test_text = "#define __builtin_warning(x, y...) (1)";
+};
+
+/*
  *  Fix various macros used to define ioctl numbers.
  *  The traditional syntax was:
  *
@@ -1509,6 +1523,60 @@ 
 };
 
 /*
+ *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
+ *  that fails when compiling for SSE-less 32-bit x86.
+ */
+fix = {
+    hackname  = feraiseexcept_nosse_invalid;
+    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+    files     = bits/fenv.h, '*/bits/fenv.h';
+    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
+		": \"x\" \\(__f\\)\\);$";
+    bypass    = "\"fdiv .*; fwait\"";
+    
+    c_fix     = format;
+    c_fix_arg = <<- _EOText_
+	# ifdef __SSE_MATH__
+	%0
+	# else
+	%1__asm__ __volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
+	%1			: "=t" (__f) : "0" (__f));
+	# endif
+	_EOText_;
+
+    test_text = <<- _EOText_
+	  __asm__ __volatile__ ("divss %0, %0" : : "x" (__f));
+	_EOText_;
+};
+
+/*
+ *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
+ *  that fails when compiling for SSE-less 32-bit x86.
+ */
+fix = {
+    hackname  = feraiseexcept_nosse_divbyzero;
+    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+    files     = bits/fenv.h, '*/bits/fenv.h';
+    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
+		": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
+    bypass    = "\"fdivp .*; fwait\"";
+    
+    c_fix     = format;
+    c_fix_arg = <<- _EOText_
+	# ifdef __SSE_MATH__
+	%0
+	# else
+	%1__asm__ __volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
+	%1			: "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+	# endif
+	_EOText_;
+
+    test_text = <<- _EOText_
+	  __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+	_EOText_;
+};
+
+/*
  *  Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume
  *  neither the existence of GCC 3 nor its exact feature set yet break
  *  (by design?) when __GNUC__ is set beyond 2.
@@ -1738,7 +1806,7 @@ 
    versions.  */
 fix = {
     hackname  = glibc_strncpy;
-    files     = bits/string2.h;
+    files     = bits/string2.h, '*/bits/string2.h';
     bypass    = "__builtin_strncpy";
     c_fix     = format;
     c_fix_arg = "#  define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
@@ -2411,7 +2479,7 @@ 
  */
 fix = {
     hackname  = huge_val_hex;
-    files     = bits/huge_val.h;
+    files     = bits/huge_val.h, '*/bits/huge_val.h';
     select    = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
     bypass    = "__builtin_huge_val";
 
@@ -2426,7 +2494,7 @@ 
  */
 fix = {
     hackname  = huge_valf_hex;
-    files     = bits/huge_val.h;
+    files     = bits/huge_val.h, '*/bits/huge_val.h';
     select    = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
     bypass    = "__builtin_huge_valf";
 
@@ -2441,7 +2509,7 @@ 
  */
 fix = {
     hackname  = huge_vall_hex;
-    files     = bits/huge_val.h;
+    files     = bits/huge_val.h, '*/bits/huge_val.h';
     select    = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
     bypass    = "__builtin_huge_vall";
 
@@ -4226,7 +4294,7 @@ 
 fix = {
     hackname  = thread_keyword;
     files     = "pthread.h";
-    files     = "bits/sigthread.h";
+    files     = bits/sigthread.h, '*/bits/sigthread.h';
     select    = "([* ])__thread([,)])";
     c_fix     = format;
     c_fix_arg = "%1__thr%2";
@@ -4760,72 +4828,4 @@ 
     test_text = "extern char *\tsprintf();";
 };
 
-/*
- *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
- *  that fails when compiling for SSE-less 32-bit x86.
- */
-fix = {
-    hackname  = feraiseexcept_nosse_invalid;
-    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
-    files     = bits/fenv.h;
-    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
-		": \"x\" \\(__f\\)\\);$";
-    bypass    = "\"fdiv .*; fwait\"";
-    
-    c_fix     = format;
-    c_fix_arg = <<- _EOText_
-	# ifdef __SSE_MATH__
-	%0
-	# else
-	%1__asm__ __volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
-	%1			: "=t" (__f) : "0" (__f));
-	# endif
-	_EOText_;
-
-    test_text = <<- _EOText_
-	  __asm__ __volatile__ ("divss %0, %0" : : "x" (__f));
-	_EOText_;
-};
-
-/*
- *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
- *  that fails when compiling for SSE-less 32-bit x86.
- */
-fix = {
-    hackname  = feraiseexcept_nosse_divbyzero;
-    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
-    files     = bits/fenv.h;
-    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
-		": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
-    bypass    = "\"fdivp .*; fwait\"";
-    
-    c_fix     = format;
-    c_fix_arg = <<- _EOText_
-	# ifdef __SSE_MATH__
-	%0
-	# else
-	%1__asm__ __volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
-	%1			: "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
-	# endif
-	_EOText_;
-
-    test_text = <<- _EOText_
-	  __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
-	_EOText_;
-};
-
-/*
- *  Old Linux kernel's <compiler.h> header breaks Traditional CPP
- */
-fix = {
-    hackname  = complier_h_tradcpp;
-    files     = linux/compiler.h;
-
-    select    = "#define __builtin_warning\\(x, y\\.\\.\\.\\) \\(1\\)";
-    c_fix     = format;
-    c_fix_arg = "/* __builtin_warning(x, y...) is obsolete */";
-
-    test_text = "#define __builtin_warning(x, y...) (1)";
-};
-
 /*EOF*/