summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/autoconf/autoconf/backports/0013-Fold-AC_C_STRINGIZE-into-AC_PROG_CC.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/autoconf/autoconf/backports/0013-Fold-AC_C_STRINGIZE-into-AC_PROG_CC.patch')
-rw-r--r--meta/recipes-devtools/autoconf/autoconf/backports/0013-Fold-AC_C_STRINGIZE-into-AC_PROG_CC.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-devtools/autoconf/autoconf/backports/0013-Fold-AC_C_STRINGIZE-into-AC_PROG_CC.patch b/meta/recipes-devtools/autoconf/autoconf/backports/0013-Fold-AC_C_STRINGIZE-into-AC_PROG_CC.patch
new file mode 100644
index 0000000000..2dadd83320
--- /dev/null
+++ b/meta/recipes-devtools/autoconf/autoconf/backports/0013-Fold-AC_C_STRINGIZE-into-AC_PROG_CC.patch
@@ -0,0 +1,84 @@
1From a7dc6d83c7d12b8409c512c3c10ad29f01e6c164 Mon Sep 17 00:00:00 2001
2From: Zack Weinberg <zackw@panix.com>
3Date: Sun, 2 Apr 2023 21:54:31 -0400
4Subject: [PATCH 13/29] Fold AC_C_STRINGIZE into AC_PROG_CC.
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Another of the last few uses of AC_EGREP_CPP is to check for the ISO C
10“stringification” operator. As this is a feature of C89, let’s fold
11the test into the extensive C89 tests we already have, and make
12AC_C_STRINGIZE just lean on AC_PROG_CC, in the same way
13AC_C_PROTOTYPES does.
14
15* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Add test of preprocessor
16 stringification and token pasting.
17 (AC_C_STRINGIZE): Just check ac_prog_cc_stdc.
18
19Upstream-Status: Backport
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21---
22 lib/autoconf/c.m4 | 31 ++++++++++++++++++++-----------
23 1 file changed, 20 insertions(+), 11 deletions(-)
24
25diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
26index 33648b5b9..c8c6a665c 100644
27--- a/lib/autoconf/c.m4
28+++ b/lib/autoconf/c.m4
29@@ -1143,6 +1143,21 @@ static char *f (char * (*g) (char **, int), char **p, ...)
30 return s;
31 }
32
33+/* C89 style stringification. */
34+#define noexpand_stringify(a) #a
35+const char *stringified = noexpand_stringify(arbitrary+token=sequence);
36+
37+/* C89 style token pasting. Exercises some of the corner cases that
38+ e.g. old MSVC gets wrong, but not very hard. */
39+#define noexpand_concat(a,b) a##b
40+#define expand_concat(a,b) noexpand_concat(a,b)
41+extern int vA;
42+extern int vbee;
43+#define aye A
44+#define bee B
45+int *pvA = &expand_concat(v,aye);
46+int *pvbee = &noexpand_concat(v,bee);
47+
48 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
49 function prototypes and stuff, but not \xHH hex character constants.
50 These do not provoke an error unfortunately, instead are silently treated
51@@ -2112,16 +2127,10 @@ fi
52 # --------------
53 # Checks if '#' can be used to glue strings together at the CPP level.
54 # Defines HAVE_STRINGIZE if positive.
55+# Obsolete - new code should assume C89 compliance.
56 AC_DEFUN([AC_C_STRINGIZE],
57-[AC_CACHE_CHECK([for preprocessor stringizing operator],
58- [ac_cv_c_stringize],
59-[AC_EGREP_CPP([@%:@teststring],
60- [@%:@define x(y) #y
61-
62-char *s = x(teststring);],
63- [ac_cv_c_stringize=no],
64- [ac_cv_c_stringize=yes])])
65-if test $ac_cv_c_stringize = yes; then
66+[AC_REQUIRE([AC_PROG_CC])
67+if test "$ac_prog_cc_stdc" != no; then
68 AC_DEFINE(HAVE_STRINGIZE, 1,
69 [Define to 1 if cpp supports the ANSI @%:@ stringizing operator.])
70 fi
71@@ -2130,8 +2139,8 @@ fi
72
73 # AC_C_PROTOTYPES
74 # ---------------
75-# Check if the C compiler supports prototypes, included if it needs
76-# options.
77+# Check if the C compiler supports prototypes.
78+# Obsolete - new code should assume C89 compliance.
79 AC_DEFUN([AC_C_PROTOTYPES],
80 [AC_REQUIRE([AC_PROG_CC])dnl
81 if test "$ac_prog_cc_stdc" != no; then
82--
832.41.0
84