public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: David Edelsohn <dje@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-3482] aix: Fix _STDC_FORMAT_MACROS in inttypes.h [PR97044]
Date: Sat, 26 Sep 2020 16:01:49 +0000 (GMT)	[thread overview]
Message-ID: <20200926160149.916FE3985479@sourceware.org> (raw)

https://gcc.gnu.org/g:081b3517b4df826ac917147eb906bbb8fc6528b1

commit r11-3482-g081b3517b4df826ac917147eb906bbb8fc6528b1
Author: David Edelsohn <dje.gcc@gmail.com>
Date:   Thu Sep 17 15:18:48 2020 +0000

    aix: Fix _STDC_FORMAT_MACROS in inttypes.h [PR97044]
    
    AIX protects the STDC Format Macros in a manner that can prevent the
    definition of the macros depending on the order of header inclusion.
    
    The protection of the macros was referenced in C99, removed in C11, and
    never specified in any C++ standard. Also, the macros are in the namespace
    reserved to the implementation (compiler) so the compiler is permitted to
    choose to inject those names.
    
    fixincludes/ChangeLog:
    
    2020-09-17  David Edelsohn  <dje.gcc@gmail.com>
    
            PR target/97044
            * inclhack.def (aix_inttypes): New fix.
            * fixincl.x: Regenerate.
            * tests/base/sys/inttypes.h: New file.

Diff:
---
 fixincludes/fixincl.x                 | 53 +++++++++++++++++++++++++++++++----
 fixincludes/inclhack.def              | 13 +++++++++
 fixincludes/tests/base/sys/inttypes.h | 14 +++++++++
 3 files changed, 75 insertions(+), 5 deletions(-)

diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index bf54305b9c0..cb966829ba3 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  September 16, 2020 at 06:34:57 PM by AutoGen 5.18
+ * It has been AutoGen-ed  September 17, 2020 at 03:10:47 PM by AutoGen 5.18
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Sep 16 18:34:57 UTC 2020
+/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Sep 17 15:10:47 UTC 2020
  *
  * 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 258 fixup descriptions.
+ * This file contains 259 fixup descriptions.
  *
  * See README for more information.
  *
@@ -883,6 +883,43 @@ static const char* apzAix_Externcpp2Patch[] = {
 #else  /* __cplusplus */",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Aix_Inttypes fix
+ */
+tSCC zAix_InttypesName[] =
+     "aix_inttypes";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zAix_InttypesList[] =
+  "sys/inttypes.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzAix_InttypesMachs[] = {
+        "*-*-aix*",
+        (const char*)NULL };
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zAix_InttypesSelect0[] =
+       "#if !defined\\(__cplusplus\\) \\|\\| defined\\(__STDC_FORMAT_MACROS\\)";
+
+#define    AIX_INTTYPES_TEST_CT  1
+static tTestDesc aAix_InttypesTests[] = {
+  { TT_EGREP,    zAix_InttypesSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Aix_Inttypes
+ */
+static const char* apzAix_InttypesPatch[] = {
+    "format",
+    "#if 1",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Aix_Malloc fix
@@ -10480,9 +10517,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          296
+#define REGEX_COUNT          297
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            258
+#define FIX_COUNT            259
 
 /*
  *  Enumerate the fixes
@@ -10505,6 +10542,7 @@ typedef enum {
     AIX_EXTERNC_FIXIDX,
     AIX_EXTERNCPP1_FIXIDX,
     AIX_EXTERNCPP2_FIXIDX,
+    AIX_INTTYPES_FIXIDX,
     AIX_MALLOC_FIXIDX,
     AIX_NET_IF_ARP_FIXIDX,
     AIX_NULL_FIXIDX,
@@ -10834,6 +10872,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      AIX_EXTERNCPP2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aAix_Externcpp2Tests,   apzAix_Externcpp2Patch, 0 },
 
+  {  zAix_InttypesName,    zAix_InttypesList,
+     apzAix_InttypesMachs,
+     AIX_INTTYPES_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aAix_InttypesTests,   apzAix_InttypesPatch, 0 },
+
   {  zAix_MallocName,    zAix_MallocList,
      apzAix_MallocMachs,
      AIX_MALLOC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 3b397422bc1..6e59be981d6 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -577,6 +577,19 @@ fix = {
 	      "#else  /* __cplusplus */";
 };
 
+/*
+ *  inttypes.h STDC_FORMAT_MACROS
+ */
+fix = {
+    hackname  = aix_inttypes;
+    mach      = "*-*-aix*";
+    files     = "sys/inttypes.h";
+    select    = "#if !defined\\(__cplusplus\\) \\|\\| defined\\(__STDC_FORMAT_MACROS\\)";
+    c_fix     = format;
+    c_fix_arg = "#if 1";
+    test_text = "#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)";
+};
+
 /*
  *  malloc.h on AIX6 uses XLC++ specific builtin syntax
  */
diff --git a/fixincludes/tests/base/sys/inttypes.h b/fixincludes/tests/base/sys/inttypes.h
new file mode 100644
index 00000000000..f349bdacdbf
--- /dev/null
+++ b/fixincludes/tests/base/sys/inttypes.h
@@ -0,0 +1,14 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/sys/inttypes.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( AIX_INTTYPES_CHECK )
+#if 1
+#endif  /* AIX_INTTYPES_CHECK */


                 reply	other threads:[~2020-09-26 16:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200926160149.916FE3985479@sourceware.org \
    --to=dje@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).