From 3fc92e702e2a3a109cacb81416557d550e26ce44 Mon Sep 17 00:00:00 2001
From: Richard Biener <rguenther@suse.de>
Date: Fri, 6 Dec 2013 08:28:35 +0000
Subject: [PATCH] inclhack.def (suse_linux_vt_cxx): New fix for linux/vt.h
 being not compatible with C++.

2013-12-06  Richard Biener  <rguenther@suse.de>

	* inclhack.def (suse_linux_vt_cxx): New fix for linux/vt.h
	being not compatible with C++.
	* tests/base/linux/vt.h: New test.

From-SVN: r205729
---
 fixincludes/ChangeLog             |  7 +++++
 fixincludes/fixincl.x             | 51 ++++++++++++++++++++++++++++---
 fixincludes/inclhack.def          | 14 +++++++++
 fixincludes/tests/base/linux/vt.h | 14 +++++++++
 4 files changed, 81 insertions(+), 5 deletions(-)
 create mode 100644 fixincludes/tests/base/linux/vt.h

diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 925423c38222..5e48ce17ad89 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,10 @@
+2013-12-06  Richard Biener  <rguenther@suse.de>
+
+	* inclhack.def (suse_linux_vt_cxx): New fix for linux/vt.h
+	being not compatible with C++.
+	* fixincl.x: Regenerate.
+	* tests/base/linux/vt.h: New test.
+
 2013-09-20  Alan Modra  <amodra@gmail.com>
 
 	* configure: Regenerate.
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index eb2ee648fba3..ec585cbd5a33 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  August 31, 2013 at 04:29:02 PM by AutoGen 5.12
+ * It has been AutoGen-ed  December  6, 2013 at 09:26:10 AM by AutoGen 5.11.8
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Aug 31 16:29:02 PDT 2013
+/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Dec  6 09:26:10 CET 2013
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 228 fixup descriptions.
+ * This file contains 229 fixup descriptions.
  *
  * See README for more information.
  *
@@ -7869,6 +7869,41 @@ static const char* apzSunos_StrlenPatch[] = {
     "__SIZE_TYPE__ strlen();%1",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Suse_Linux_Vt_Cxx fix
+ */
+tSCC zSuse_Linux_Vt_CxxName[] =
+     "suse_linux_vt_cxx";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zSuse_Linux_Vt_CxxList[] =
+  "linux/vt.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzSuse_Linux_Vt_CxxMachs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zSuse_Linux_Vt_CxxSelect0[] =
+       "^[ \t]*unsigned int new;";
+
+#define    SUSE_LINUX_VT_CXX_TEST_CT  1
+static tTestDesc aSuse_Linux_Vt_CxxTests[] = {
+  { TT_EGREP,    zSuse_Linux_Vt_CxxSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Suse_Linux_Vt_Cxx
+ */
+static const char* apzSuse_Linux_Vt_CxxPatch[] = {
+    "format",
+    "unsigned int newev;",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Svr4_Disable_Opt fix
@@ -9368,9 +9403,9 @@ static const char* apzComplier_H_TradcppPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          267
+#define REGEX_COUNT          268
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            228
+#define FIX_COUNT            229
 
 /*
  *  Enumerate the fixes
@@ -9566,6 +9601,7 @@ typedef enum {
     SUN_RUSERS_SEMI_FIXIDX,
     SUN_SIGNAL_FIXIDX,
     SUNOS_STRLEN_FIXIDX,
+    SUSE_LINUX_VT_CXX_FIXIDX,
     SVR4_DISABLE_OPT_FIXIDX,
     SVR4_GETCWD_FIXIDX,
     SVR4_PROFIL_FIXIDX,
@@ -10557,6 +10593,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      SUNOS_STRLEN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aSunos_StrlenTests,   apzSunos_StrlenPatch, 0 },
 
+  {  zSuse_Linux_Vt_CxxName,    zSuse_Linux_Vt_CxxList,
+     apzSuse_Linux_Vt_CxxMachs,
+     SUSE_LINUX_VT_CXX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aSuse_Linux_Vt_CxxTests,   apzSuse_Linux_Vt_CxxPatch, 0 },
+
   {  zSvr4_Disable_OptName,    zSvr4_Disable_OptList,
      apzSvr4_Disable_OptMachs,
      SVR4_DISABLE_OPT_TEST_CT, FD_MACH_ONLY,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 996356a3930a..11ac9448c5b3 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -4065,6 +4065,20 @@ fix = {
     test_text = " int\tstrlen(); /* string length */";
 };
 
+/*
+ *  Linux kernel's vt.h breaks C++
+ */
+fix = {
+    hackname  = suse_linux_vt_cxx;
+    files     = linux/vt.h;
+
+    select    = "^[ \t]*unsigned int new;";
+    c_fix     = format;
+    c_fix_arg = "unsigned int newev;";
+
+    test_text = "        unsigned int new;               /* New console (if changing) */";
+};
+
 /*
  *  Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
  *  that is visible to any ANSI compiler using this include.  Simply
diff --git a/fixincludes/tests/base/linux/vt.h b/fixincludes/tests/base/linux/vt.h
new file mode 100644
index 000000000000..4814ab642c07
--- /dev/null
+++ b/fixincludes/tests/base/linux/vt.h
@@ -0,0 +1,14 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/linux/vt.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( SUSE_LINUX_VT_CXX_CHECK )
+unsigned int newev;               /* New console (if changing) */
+#endif  /* SUSE_LINUX_VT_CXX_CHECK */
-- 
GitLab