12.0.0-0.3
This commit is contained in:
parent
671fc7ba16
commit
cdf92292af
1
.gitignore
vendored
1
.gitignore
vendored
@ -54,3 +54,4 @@
|
||||
/gcc-11.2.1-20211018.tar.xz
|
||||
/gcc-11.2.1-20211019.tar.xz
|
||||
/gcc-11.2.1-20211203.tar.xz
|
||||
/gcc-12.0.0-20220108.tar.xz
|
||||
|
@ -1,27 +0,0 @@
|
||||
2017-02-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* configure.ac: When adding -Wno-format, also add -Wno-format-security.
|
||||
* configure: Regenerated.
|
||||
|
||||
--- gcc/configure.ac.jj 2017-02-13 12:20:53.000000000 +0100
|
||||
+++ gcc/configure.ac 2017-02-25 12:42:32.859175403 +0100
|
||||
@@ -480,7 +480,7 @@ AC_ARG_ENABLE(build-format-warnings,
|
||||
AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]),
|
||||
[],[enable_build_format_warnings=yes])
|
||||
AS_IF([test $enable_build_format_warnings = no],
|
||||
- [wf_opt=-Wno-format],[wf_opt=])
|
||||
+ [wf_opt="-Wno-format -Wno-format-security"],[wf_opt=])
|
||||
ACX_PROG_CXX_WARNING_OPTS(
|
||||
m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ],
|
||||
[-Wcast-qual -Wno-error=format-diag $wf_opt])),
|
||||
--- gcc/configure.jj 2017-02-13 12:20:52.000000000 +0100
|
||||
+++ gcc/configure 2017-02-25 12:42:50.041946391 +0100
|
||||
@@ -6647,7 +6647,7 @@ else
|
||||
fi
|
||||
|
||||
if test $enable_build_format_warnings = no; then :
|
||||
- wf_opt=-Wno-format
|
||||
+ wf_opt="-Wno-format -Wno-format-security"
|
||||
else
|
||||
wf_opt=
|
||||
fi
|
@ -1,116 +0,0 @@
|
||||
2019-01-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* gcc.c (offload_targets_default): New variable.
|
||||
(process_command): Set it if -foffload is defaulted.
|
||||
(driver::maybe_putenv_OFFLOAD_TARGETS): Add OFFLOAD_TARGET_DEFAULT=1
|
||||
into environment if -foffload has been defaulted.
|
||||
* lto-wrapper.c (OFFLOAD_TARGET_DEFAULT_ENV): Define.
|
||||
(compile_offload_image): If OFFLOAD_TARGET_DEFAULT
|
||||
is in the environment, don't fail if corresponding mkoffload
|
||||
can't be found.
|
||||
(compile_images_for_offload_targets): Likewise. Free and clear
|
||||
offload_names if no valid offload is found.
|
||||
libgomp/
|
||||
* target.c (gomp_load_plugin_for_device): If a plugin can't be
|
||||
dlopened, assume it has no devices silently.
|
||||
|
||||
--- gcc/gcc.c.jj 2017-01-17 10:28:40.000000000 +0100
|
||||
+++ gcc/gcc.c 2017-01-20 16:26:29.649962902 +0100
|
||||
@@ -319,6 +319,10 @@ static const char *spec_host_machine = D
|
||||
|
||||
static char *offload_targets = NULL;
|
||||
|
||||
+/* Set to true if -foffload has not been used and offload_targets
|
||||
+ is set to the configured in default. */
|
||||
+static bool offload_targets_default;
|
||||
+
|
||||
/* Nonzero if cross-compiling.
|
||||
When -b is used, the value comes from the `specs' file. */
|
||||
|
||||
@@ -4828,7 +4832,10 @@ process_command (unsigned int decoded_op
|
||||
/* If the user didn't specify any, default to all configured offload
|
||||
targets. */
|
||||
if (ENABLE_OFFLOADING && offload_targets == NULL)
|
||||
- handle_foffload_option (OFFLOAD_TARGETS);
|
||||
+ {
|
||||
+ handle_foffload_option (OFFLOAD_TARGETS);
|
||||
+ offload_targets_default = true;
|
||||
+ }
|
||||
|
||||
/* Handle -gtoggle as it would later in toplev.c:process_options to
|
||||
make the debug-level-gt spec function work as expected. */
|
||||
@@ -8494,6 +8501,8 @@ driver::maybe_putenv_OFFLOAD_TARGETS ()
|
||||
obstack_grow (&collect_obstack, offload_targets,
|
||||
strlen (offload_targets) + 1);
|
||||
xputenv (XOBFINISH (&collect_obstack, char *));
|
||||
+ if (offload_targets_default)
|
||||
+ xputenv ("OFFLOAD_TARGET_DEFAULT=1");
|
||||
}
|
||||
|
||||
free (offload_targets);
|
||||
--- gcc/lto-wrapper.c.jj 2017-01-01 12:45:34.000000000 +0100
|
||||
+++ gcc/lto-wrapper.c 2017-01-20 16:34:18.294016997 +0100
|
||||
@@ -52,6 +52,7 @@ along with GCC; see the file COPYING3.
|
||||
/* Environment variable, used for passing the names of offload targets from GCC
|
||||
driver to lto-wrapper. */
|
||||
#define OFFLOAD_TARGET_NAMES_ENV "OFFLOAD_TARGET_NAMES"
|
||||
+#define OFFLOAD_TARGET_DEFAULT_ENV "OFFLOAD_TARGET_DEFAULT"
|
||||
|
||||
/* By default there is no special suffix for target executables. */
|
||||
#ifdef TARGET_EXECUTABLE_SUFFIX
|
||||
@@ -906,6 +907,12 @@ compile_offload_image (const char *targe
|
||||
break;
|
||||
}
|
||||
|
||||
+ if (!compiler && getenv (OFFLOAD_TARGET_DEFAULT_ENV))
|
||||
+ {
|
||||
+ free_array_of_ptrs ((void **) paths, n_paths);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
if (!compiler)
|
||||
fatal_error (input_location,
|
||||
"could not find %s in %s (consider using %<-B%>)",
|
||||
@@ -975,6 +982,7 @@ compile_images_for_offload_targets (unsi
|
||||
if (!target_names)
|
||||
return;
|
||||
unsigned num_targets = parse_env_var (target_names, &names, NULL);
|
||||
+ int next_name_entry = 0;
|
||||
|
||||
const char *compiler_path = getenv ("COMPILER_PATH");
|
||||
if (!compiler_path)
|
||||
@@ -985,13 +993,19 @@ compile_images_for_offload_targets (unsi
|
||||
offload_names = XCNEWVEC (char *, num_targets + 1);
|
||||
for (unsigned i = 0; i < num_targets; i++)
|
||||
{
|
||||
- offload_names[i]
|
||||
+ offload_names[next_name_entry]
|
||||
= compile_offload_image (names[i], compiler_path, in_argc, in_argv,
|
||||
compiler_opts, compiler_opt_count,
|
||||
linker_opts, linker_opt_count);
|
||||
- if (!offload_names[i])
|
||||
- fatal_error (input_location,
|
||||
- "problem with building target image for %s", names[i]);
|
||||
+ if (!offload_names[next_name_entry])
|
||||
+ continue;
|
||||
+ next_name_entry++;
|
||||
+ }
|
||||
+
|
||||
+ if (next_name_entry == 0)
|
||||
+ {
|
||||
+ free (offload_names);
|
||||
+ offload_names = NULL;
|
||||
}
|
||||
|
||||
out:
|
||||
--- libgomp/target.c.jj 2017-01-01 12:45:52.000000000 +0100
|
||||
+++ libgomp/target.c 2017-01-20 20:12:13.756710875 +0100
|
||||
@@ -2356,7 +2356,7 @@ gomp_load_plugin_for_device (struct gomp
|
||||
|
||||
void *plugin_handle = dlopen (plugin_name, RTLD_LAZY);
|
||||
if (!plugin_handle)
|
||||
- goto dl_fail;
|
||||
+ return 0;
|
||||
|
||||
/* Check if all required functions are available in the plugin and store
|
||||
their handlers. None of the symbols can legitimately be NULL,
|
@ -1,57 +0,0 @@
|
||||
libgcc: Honor LDFLAGS_FOR_TARGET when linking libgcc_s
|
||||
|
||||
When building gcc with some specific LDFLAGS_FOR_TARGET, e.g.
|
||||
LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z,now
|
||||
those flags propagate info linking of target shared libraries,
|
||||
e.g. lib{ubsan,tsan,stdc++,quadmath,objc,lsan,itm,gphobos,gdruntime,gomp,go,gfortran,atomic,asan}.so.*
|
||||
but there is one important exception, libgcc_s.so.* linking ignores it.
|
||||
|
||||
The following patch fixes that.
|
||||
|
||||
Bootstrapped/regtested on x86_64-linux with LDFLAGS_FOR_TARGET=-Wl,-z,relro,-z,now
|
||||
and verified that libgcc_s.so.* is BIND_NOW when it previously wasn't, and
|
||||
without any LDFLAGS_FOR_TARGET on x86_64-linux and i686-linux.
|
||||
There on x86_64-linux I've verified that the libgcc_s.so.1 linking command
|
||||
line for -m64 is identical except for whitespace to one without the patch,
|
||||
and for -m32 multilib $(LDFLAGS) actually do supply there an extra -m32
|
||||
that also repeats later in the @multilib_flags@, which should be harmless.
|
||||
|
||||
2021-08-04 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* config/t-slibgcc (SHLIB_LINK): Add $(LDFLAGS).
|
||||
* config/t-slibgcc-darwin (SHLIB_LINK): Likewise.
|
||||
* config/t-slibgcc-vms (SHLIB_LINK): Likewise.
|
||||
|
||||
--- libgcc/config/t-slibgcc
|
||||
+++ libgcc/config/t-slibgcc
|
||||
@@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
|
||||
$(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
|
||||
|
||||
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
|
||||
- $(SHLIB_LDFLAGS) \
|
||||
+ $(SHLIB_LDFLAGS) $(LDFLAGS) \
|
||||
-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
|
||||
$(SHLIB_OBJS) $(SHLIB_LC) && \
|
||||
rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
|
||||
--- libgcc/config/t-slibgcc-darwin
|
||||
+++ libgcc/config/t-slibgcc-darwin
|
||||
@@ -15,7 +15,7 @@ SHLIB_LC = -lc
|
||||
# Note that this version is used for the loader, not the linker; the linker
|
||||
# uses the stub versions named by the versioned members of $(INSTALL_FILES).
|
||||
|
||||
-SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -dynamiclib -nodefaultlibs \
|
||||
+SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
|
||||
-install_name @shlib_slibdir@/$(SHLIB_INSTALL_NAME) \
|
||||
-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
|
||||
-Wl,-exported_symbols_list,$(SHLIB_MAP) \
|
||||
--- libgcc/config/t-slibgcc-vms
|
||||
+++ libgcc/config/t-slibgcc-vms
|
||||
@@ -22,7 +22,7 @@ SHLIB_LINK = \
|
||||
objdump --syms $(SHLIB_OBJS) | \
|
||||
$(SHLIB_SYMVEC) >> SYMVEC_$$$$.opt ; \
|
||||
echo "case_sensitive=NO" >> SYMVEC_$$$$.opt; \
|
||||
- $(CC) $(LIBGCC2_CFLAGS) -nodefaultlibs \
|
||||
+ $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -nodefaultlibs \
|
||||
-shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
|
||||
--for-linker=SYMVEC_$$$$.opt \
|
||||
--for-linker=gsmatch=equal,$(shlib_version)
|
@ -1,66 +0,0 @@
|
||||
c++: Optimize constinit thread_local vars [PR101786]
|
||||
|
||||
The paper that introduced constinit mentioned in rationale that constinit
|
||||
can be used on externs as well and that it can be used to avoid the
|
||||
thread_local initialization wrappers, because the standard requires that
|
||||
if constinit is present on any declaration, it is also present on the
|
||||
initialization declaration, even if it is in some other TU etc.
|
||||
|
||||
There is a small problem though, we use the tls wrappers not just if
|
||||
the thread_local variable needs dynamic initialization, but also when
|
||||
it has static initialization, but non-trivial destructor, as the
|
||||
"dynamic initialization" in that case needs to register the destructor.
|
||||
|
||||
So, the following patch optimizes constinit thread_local vars only
|
||||
if we can prove they will not have non-trivial destructors. That includes
|
||||
the case where we have incomplete type where we don't know and need to
|
||||
conservatively assume the type will have non-trivial destructor at the
|
||||
initializing declaration side.
|
||||
|
||||
2021-08-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/101786
|
||||
* decl2.c (var_defined_without_dynamic_init): Return true for
|
||||
DECL_DECLARED_CONSTINIT_P with complete type and trivial destructor.
|
||||
|
||||
* g++.dg/cpp2a/constinit16.C: New test.
|
||||
|
||||
--- gcc/cp/decl2.c
|
||||
+++ gcc/cp/decl2.c
|
||||
@@ -3447,6 +3447,12 @@ set_guard (tree guard)
|
||||
static bool
|
||||
var_defined_without_dynamic_init (tree var)
|
||||
{
|
||||
+ /* constinit vars are guaranteed to not have dynamic initializer,
|
||||
+ but still registering the destructor counts as dynamic initialization. */
|
||||
+ if (DECL_DECLARED_CONSTINIT_P (var)
|
||||
+ && COMPLETE_TYPE_P (TREE_TYPE (var))
|
||||
+ && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (var)))
|
||||
+ return true;
|
||||
/* If it's defined in another TU, we can't tell. */
|
||||
if (DECL_EXTERNAL (var))
|
||||
return false;
|
||||
--- gcc/testsuite/g++.dg/cpp2a/constinit16.C
|
||||
+++ gcc/testsuite/g++.dg/cpp2a/constinit16.C
|
||||
@@ -0,0 +1,21 @@
|
||||
+// PR c++/101786
|
||||
+// { dg-do compile { target c++20 } }
|
||||
+// { dg-add-options tls }
|
||||
+// { dg-require-alias "" }
|
||||
+// { dg-require-effective-target tls_runtime }
|
||||
+// { dg-final { scan-assembler-not "_ZTH17mythreadlocalvar1" } }
|
||||
+// { dg-final { scan-assembler "_ZTH17mythreadlocalvar2" } }
|
||||
+// { dg-final { scan-assembler-not "_ZTH17mythreadlocalvar3" } }
|
||||
+// { dg-final { scan-assembler "_ZTH17mythreadlocalvar4" } }
|
||||
+
|
||||
+extern thread_local constinit int mythreadlocalvar1;
|
||||
+struct S;
|
||||
+extern thread_local constinit S mythreadlocalvar2;
|
||||
+struct T { int t; };
|
||||
+extern thread_local constinit T mythreadlocalvar3;
|
||||
+struct U { int u; ~U (); };
|
||||
+extern thread_local constinit U mythreadlocalvar4;
|
||||
+int foo () { return mythreadlocalvar1; }
|
||||
+S *bar () { return &mythreadlocalvar2; }
|
||||
+T *baz () { return &mythreadlocalvar3; }
|
||||
+U *qux () { return &mythreadlocalvar4; }
|
@ -1,176 +0,0 @@
|
||||
libstdc++: Remove symbols for new std::call_once implementation [PR 99341]
|
||||
|
||||
This removes the new symbols added for the new futex-based
|
||||
std::call_once implementation. These symbols were new on trunk, so not
|
||||
in any released version. However, they are already present in some
|
||||
beta distro releases (Fedora Linux 34) and in Fedora Linux rawhide. This
|
||||
change can be locally reverted by distros that need to keep the symbols
|
||||
present until affected packages have been rebuilt.
|
||||
|
||||
Revert:
|
||||
2021-03-12 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++/99341
|
||||
* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Remove
|
||||
std::once_flag symbols.
|
||||
* config/abi/post/ia64-linux-gnu/baseline_symbols.txt: Likewise.
|
||||
* config/abi/post/m68k-linux-gnu/baseline_symbols.txt: Likewise.
|
||||
* config/abi/post/riscv64-linux-gnu/baseline_symbols.txt:
|
||||
Likewise.
|
||||
* config/abi/pre/gnu.ver: Likewise.
|
||||
* src/c++11/mutex.cc [_GLIBCXX_HAVE_LINUX_FUTEX]
|
||||
(struct __once_flag_compat): Remove.
|
||||
(_ZNSt9once_flag11_M_activateEv): Remove.
|
||||
(_ZNSt9once_flag9_M_finishEb): Remove.
|
||||
|
||||
--- libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt
|
||||
+++ libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt
|
||||
@@ -4086,6 +4086,8 @@ FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2Em@@GLIBCXX
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED2Ev@@GLIBCXX_3.4
|
||||
+FUNC:_ZNSt9once_flag11_M_activateEv@@GLIBCXX_3.4.29
|
||||
+FUNC:_ZNSt9once_flag9_M_finishEb@@GLIBCXX_3.4.29
|
||||
FUNC:_ZNSt9strstream3strEv@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9strstream6freezeEb@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9strstreamC1EPciSt13_Ios_Openmode@@GLIBCXX_3.4
|
||||
--- libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt
|
||||
+++ libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt
|
||||
@@ -4086,6 +4086,8 @@ FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2Em@@GLIBCXX
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED2Ev@@GLIBCXX_3.4
|
||||
+FUNC:_ZNSt9once_flag11_M_activateEv@@GLIBCXX_3.4.29
|
||||
+FUNC:_ZNSt9once_flag9_M_finishEb@@GLIBCXX_3.4.29
|
||||
FUNC:_ZNSt9strstream3strEv@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9strstream6freezeEb@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9strstreamC1EPciSt13_Ios_Openmode@@GLIBCXX_3.4
|
||||
--- libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt
|
||||
+++ libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt
|
||||
@@ -4086,6 +4086,8 @@ FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2Ej@@GLIBCXX
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED2Ev@@GLIBCXX_3.4
|
||||
+FUNC:_ZNSt9once_flag11_M_activateEv@@GLIBCXX_3.4.29
|
||||
+FUNC:_ZNSt9once_flag9_M_finishEb@@GLIBCXX_3.4.29
|
||||
FUNC:_ZNSt9strstream3strEv@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9strstream6freezeEb@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9strstreamC1EPciSt13_Ios_Openmode@@GLIBCXX_3.4
|
||||
--- libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt
|
||||
+++ libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt
|
||||
@@ -4086,6 +4086,8 @@ FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2Em@@GLIBCXX
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED2Ev@@GLIBCXX_3.4
|
||||
+FUNC:_ZNSt9once_flag11_M_activateEv@@GLIBCXX_3.4.29
|
||||
+FUNC:_ZNSt9once_flag9_M_finishEb@@GLIBCXX_3.4.29
|
||||
FUNC:_ZNSt9strstream3strEv@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9strstream6freezeEb@@GLIBCXX_3.4
|
||||
FUNC:_ZNSt9strstreamC1EPciSt13_Ios_Openmode@@GLIBCXX_3.4
|
||||
--- libstdc++-v3/config/abi/pre/gnu.ver
|
||||
+++ libstdc++-v3/config/abi/pre/gnu.ver
|
||||
@@ -2388,6 +2388,11 @@ GLIBCXX_3.4.29 {
|
||||
_ZNKRSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEv;
|
||||
_ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEONS_12basic_stringI[cw]S2_S3_EE;
|
||||
|
||||
+ # std::once_flag::_M_activate()
|
||||
+ _ZNSt9once_flag11_M_activateEv;
|
||||
+ # std::once_flag::_M_finish(bool)
|
||||
+ _ZNSt9once_flag9_M_finishEb;
|
||||
+
|
||||
# std::to_chars(char*, char*, [float|double|long double])
|
||||
_ZSt8to_charsPcS_[def];
|
||||
# std::to_chars(char*, char*, [float|double|long double], chars_format)
|
||||
--- libstdc++-v3/src/c++11/mutex.cc
|
||||
+++ libstdc++-v3/src/c++11/mutex.cc
|
||||
@@ -26,6 +26,90 @@
|
||||
|
||||
#ifdef _GLIBCXX_HAS_GTHREADS
|
||||
|
||||
+#if defined _GLIBCXX_SHARED && ! _GLIBCXX_INLINE_VERSION
|
||||
+
|
||||
+#ifdef _GLIBCXX_HAVE_LINUX_FUTEX
|
||||
+# include <syscall.h>
|
||||
+# include <unistd.h>
|
||||
+# include <limits.h>
|
||||
+
|
||||
+namespace std _GLIBCXX_VISIBILITY(default)
|
||||
+{
|
||||
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
+
|
||||
+struct __once_flag_compat
|
||||
+{
|
||||
+ enum _Bits : int { _Init = 0, _Active = 1, _Done = 2 };
|
||||
+ int _M_once = 0;
|
||||
+ bool _M_activate();
|
||||
+ void _M_finish(bool returning) noexcept;
|
||||
+};
|
||||
+
|
||||
+bool
|
||||
+__once_flag_compat::_M_activate()
|
||||
+{
|
||||
+ if (__gnu_cxx::__is_single_threaded())
|
||||
+ {
|
||||
+ if (_M_once == _Bits::_Done)
|
||||
+ return false;
|
||||
+ _M_once = _Bits::_Active;
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ while (true)
|
||||
+ {
|
||||
+ int expected = _Bits::_Init;
|
||||
+ constexpr int active = _Bits::_Active;
|
||||
+ if (__atomic_compare_exchange_n(&_M_once, &expected, active, false,
|
||||
+ __ATOMIC_ACQ_REL,
|
||||
+ __ATOMIC_ACQUIRE))
|
||||
+ {
|
||||
+ // This thread is now doing an active execution.
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (expected == _Bits::_Done)
|
||||
+ return false; // A returning execution happened, this is passive.
|
||||
+
|
||||
+ // Otherwise, an active execution is happening. Wait for it to finish.
|
||||
+ constexpr int futex_wait = 128; // FUTEX_WAIT_PRIVATE
|
||||
+ syscall (SYS_futex, &_M_once, futex_wait, expected, 0);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+std::__once_flag_compat::_M_finish(bool returning) noexcept
|
||||
+{
|
||||
+ const int newval = returning ? _Bits::_Done : _Bits::_Init;
|
||||
+ if (__gnu_cxx::__is_single_threaded())
|
||||
+ {
|
||||
+ __glibcxx_assert(_M_once == _Bits::_Active);
|
||||
+ _M_once = newval;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ int prev [[maybe_unused]]
|
||||
+ = __atomic_exchange_n(&_M_once, newval, __ATOMIC_RELEASE);
|
||||
+ __glibcxx_assert(prev & _Bits::_Active);
|
||||
+ // Wake any other threads waiting for this execution to finish.
|
||||
+ constexpr int futex_wake = 129; // FUTEX_WAKE_PRIVATE
|
||||
+ syscall (SYS_futex, &_M_once, futex_wake, INT_MAX);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#pragma GCC diagnostic push
|
||||
+#pragma GCC diagnostic ignored "-Wattribute-alias"
|
||||
+extern "C" bool _ZNSt9once_flag11_M_activateEv()
|
||||
+ __attribute__((alias ("_ZNSt18__once_flag_compat11_M_activateEv")));
|
||||
+extern "C" void _ZNSt9once_flag9_M_finishEb() noexcept
|
||||
+ __attribute__((alias ("_ZNSt18__once_flag_compat9_M_finishEb")));
|
||||
+#pragma GCC diagnostic pop
|
||||
+
|
||||
+_GLIBCXX_END_NAMESPACE_VERSION
|
||||
+} // namespace std
|
||||
+#endif // FUTEX
|
||||
+#endif // ONCE_FLAG_COMPAT && SHARED && ! INLINE_VERSION
|
||||
+
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
@ -1,197 +0,0 @@
|
||||
libcpp: Fix up #__VA_OPT__ handling [PR103415]
|
||||
|
||||
stringify_arg uses pfile->u_buff to create the string literal.
|
||||
Unfortunately, paste_tokens -> _cpp_lex_direct -> lex_number -> _cpp_unaligned_alloc
|
||||
can in some cases use pfile->u_buff too, which results in losing everything
|
||||
prepared for the string literal until the token pasting.
|
||||
|
||||
The following patch fixes that by not calling paste_token during the
|
||||
construction of the string literal, but doing that before. All the tokens
|
||||
we are processing have been pushed into a token buffer using
|
||||
tokens_buff_add_token so it is fine if we paste some of them in that buffer
|
||||
(successful pasting creates a new token in that buffer), move following
|
||||
tokens if any to make it contiguous, pop (throw away) the extra tokens at
|
||||
the end and then do stringify_arg.
|
||||
|
||||
Also, paste_tokens now copies over PREV_WHITE and PREV_FALLTHROUGH flags
|
||||
from the original lhs token to the replacement token. Copying that way
|
||||
the PREV_WHITE flag is needed for the #__VA_OPT__ handling and copying
|
||||
over PREV_FALLTHROUGH fixes the new Wimplicit-fallthrough-38.c test.
|
||||
|
||||
2021-12-01 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR preprocessor/103415
|
||||
libcpp/
|
||||
* macro.c (stringify_arg): Remove va_opt argument and va_opt handling.
|
||||
(paste_tokens): On successful paste or in PREV_WHITE and
|
||||
PREV_FALLTHROUGH flags from the *plhs token to the new token.
|
||||
(replace_args): Adjust stringify_arg callers. For #__VA_OPT__,
|
||||
perform token pasting in a separate loop before stringify_arg call.
|
||||
gcc/testsuite/
|
||||
* c-c++-common/cpp/va-opt-8.c: New test.
|
||||
* c-c++-common/Wimplicit-fallthrough-38.c: New test.
|
||||
|
||||
--- libcpp/macro.c.jj
|
||||
+++ libcpp/macro.c
|
||||
@@ -295,7 +295,7 @@ static cpp_context *next_context (cpp_reader *);
|
||||
static const cpp_token *padding_token (cpp_reader *, const cpp_token *);
|
||||
static const cpp_token *new_string_token (cpp_reader *, uchar *, unsigned int);
|
||||
static const cpp_token *stringify_arg (cpp_reader *, const cpp_token **,
|
||||
- unsigned int, bool);
|
||||
+ unsigned int);
|
||||
static void paste_all_tokens (cpp_reader *, const cpp_token *);
|
||||
static bool paste_tokens (cpp_reader *, location_t,
|
||||
const cpp_token **, const cpp_token *);
|
||||
@@ -834,8 +834,7 @@ cpp_quote_string (uchar *dest, const uchar *src, unsigned int len)
|
||||
/* Convert a token sequence FIRST to FIRST+COUNT-1 to a single string token
|
||||
according to the rules of the ISO C #-operator. */
|
||||
static const cpp_token *
|
||||
-stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count,
|
||||
- bool va_opt)
|
||||
+stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count)
|
||||
{
|
||||
unsigned char *dest;
|
||||
unsigned int i, escape_it, backslash_count = 0;
|
||||
@@ -852,24 +851,6 @@ stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count,
|
||||
{
|
||||
const cpp_token *token = first[i];
|
||||
|
||||
- if (va_opt && (token->flags & PASTE_LEFT))
|
||||
- {
|
||||
- location_t virt_loc = pfile->invocation_location;
|
||||
- const cpp_token *rhs;
|
||||
- do
|
||||
- {
|
||||
- if (i == count)
|
||||
- abort ();
|
||||
- rhs = first[++i];
|
||||
- if (!paste_tokens (pfile, virt_loc, &token, rhs))
|
||||
- {
|
||||
- --i;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- while (rhs->flags & PASTE_LEFT);
|
||||
- }
|
||||
-
|
||||
if (token->type == CPP_PADDING)
|
||||
{
|
||||
if (source == NULL
|
||||
@@ -1003,6 +984,7 @@ paste_tokens (cpp_reader *pfile, location_t location,
|
||||
return false;
|
||||
}
|
||||
|
||||
+ lhs->flags |= (*plhs)->flags & (PREV_WHITE | PREV_FALLTHROUGH);
|
||||
*plhs = lhs;
|
||||
_cpp_pop_buffer (pfile);
|
||||
return true;
|
||||
@@ -1945,8 +1927,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro,
|
||||
if (src->flags & STRINGIFY_ARG)
|
||||
{
|
||||
if (!arg->stringified)
|
||||
- arg->stringified = stringify_arg (pfile, arg->first, arg->count,
|
||||
- false);
|
||||
+ arg->stringified = stringify_arg (pfile, arg->first, arg->count);
|
||||
}
|
||||
else if ((src->flags & PASTE_LEFT)
|
||||
|| (src != macro->exp.tokens && (src[-1].flags & PASTE_LEFT)))
|
||||
@@ -2066,11 +2047,46 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro,
|
||||
{
|
||||
unsigned int count
|
||||
= start ? paste_flag - start : tokens_buff_count (buff);
|
||||
- const cpp_token *t
|
||||
- = stringify_arg (pfile,
|
||||
- start ? start + 1
|
||||
- : (const cpp_token **) (buff->base),
|
||||
- count, true);
|
||||
+ const cpp_token **first
|
||||
+ = start ? start + 1
|
||||
+ : (const cpp_token **) (buff->base);
|
||||
+ unsigned int i, j;
|
||||
+
|
||||
+ /* Paste any tokens that need to be pasted before calling
|
||||
+ stringify_arg, because stringify_arg uses pfile->u_buff
|
||||
+ which paste_tokens can use as well. */
|
||||
+ for (i = 0, j = 0; i < count; i++, j++)
|
||||
+ {
|
||||
+ const cpp_token *token = first[i];
|
||||
+
|
||||
+ if (token->flags & PASTE_LEFT)
|
||||
+ {
|
||||
+ location_t virt_loc = pfile->invocation_location;
|
||||
+ const cpp_token *rhs;
|
||||
+ do
|
||||
+ {
|
||||
+ if (i == count)
|
||||
+ abort ();
|
||||
+ rhs = first[++i];
|
||||
+ if (!paste_tokens (pfile, virt_loc, &token, rhs))
|
||||
+ {
|
||||
+ --i;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ while (rhs->flags & PASTE_LEFT);
|
||||
+ }
|
||||
+
|
||||
+ first[j] = token;
|
||||
+ }
|
||||
+ if (j != i)
|
||||
+ {
|
||||
+ while (i-- != j)
|
||||
+ tokens_buff_remove_last_token (buff);
|
||||
+ count = j;
|
||||
+ }
|
||||
+
|
||||
+ const cpp_token *t = stringify_arg (pfile, first, count);
|
||||
while (count--)
|
||||
tokens_buff_remove_last_token (buff);
|
||||
if (src->flags & PASTE_LEFT)
|
||||
--- gcc/testsuite/c-c++-common/cpp/va-opt-8.c.jj
|
||||
+++ gcc/testsuite/c-c++-common/cpp/va-opt-8.c
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* PR preprocessor/103415 */
|
||||
+/* { dg-do run } */
|
||||
+/* { dg-options "-std=gnu99" { target c } } */
|
||||
+/* { dg-options "-std=c++20" { target c++ } } */
|
||||
+
|
||||
+#define n(x, ...) = #__VA_OPT__(x##3)
|
||||
+#define o(x, ...) #__VA_OPT__(x##__VA_ARGS__##9)
|
||||
+const char *c n(1 2, 4);
|
||||
+const char *d = o(5 6, 7 8);
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ if (__builtin_strcmp (c, "1 23")
|
||||
+ || __builtin_strcmp (d, "5 67 89"))
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- gcc/testsuite/c-c++-common/Wimplicit-fallthrough-38.c.jj
|
||||
+++ gcc/testsuite/c-c++-common/Wimplicit-fallthrough-38.c
|
||||
@@ -0,0 +1,24 @@
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-Wimplicit-fallthrough=3" } */
|
||||
+
|
||||
+#define FOO \
|
||||
+int \
|
||||
+foo (int a) \
|
||||
+{ \
|
||||
+ switch (a) \
|
||||
+ { \
|
||||
+ case 1: \
|
||||
+ ++a; \
|
||||
+ /* FALLTHRU */ \
|
||||
+ case 2: \
|
||||
+ ++a; \
|
||||
+ /* FALLTHRU */ \
|
||||
+ ca##se 3: \
|
||||
+ ++a; \
|
||||
+ default: \
|
||||
+ break; \
|
||||
+ } \
|
||||
+ return a; \
|
||||
+}
|
||||
+
|
||||
+FOO
|
@ -1,308 +0,0 @@
|
||||
c++: Add C++20 #__VA_OPT__ support
|
||||
|
||||
The following patch implements C++20 # __VA_OPT__ (...) support.
|
||||
Testcases cover what I came up with myself and what LLVM has for #__VA_OPT__
|
||||
in its testsuite and the string literals are identical between the two
|
||||
compilers on the va-opt-5.c testcase.
|
||||
|
||||
2021-08-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
libcpp/
|
||||
* macro.c (vaopt_state): Add m_stringify member.
|
||||
(vaopt_state::vaopt_state): Initialize it.
|
||||
(vaopt_state::update): Overwrite it.
|
||||
(vaopt_state::stringify): New method.
|
||||
(stringify_arg): Replace arg argument with first, count arguments
|
||||
and add va_opt argument. Use first instead of arg->first and
|
||||
count instead of arg->count, for va_opt add paste_tokens handling.
|
||||
(paste_tokens): Fix up len calculation. Don't spell rhs twice,
|
||||
instead use %.*s to supply lhs and rhs spelling lengths. Don't call
|
||||
_cpp_backup_tokens here.
|
||||
(paste_all_tokens): Call it here instead.
|
||||
(replace_args): Adjust stringify_arg caller. For vaopt_state::END
|
||||
if stringify is true handle __VA_OPT__ stringification.
|
||||
(create_iso_definition): Handle # __VA_OPT__ similarly to # macro_arg.
|
||||
gcc/testsuite/
|
||||
* c-c++-common/cpp/va-opt-5.c: New test.
|
||||
* c-c++-common/cpp/va-opt-6.c: New test.
|
||||
|
||||
--- libcpp/macro.c
|
||||
+++ libcpp/macro.c
|
||||
@@ -118,6 +118,7 @@ class vaopt_state {
|
||||
m_arg (arg),
|
||||
m_variadic (is_variadic),
|
||||
m_last_was_paste (false),
|
||||
+ m_stringify (false),
|
||||
m_state (0),
|
||||
m_paste_location (0),
|
||||
m_location (0),
|
||||
@@ -145,6 +146,7 @@ class vaopt_state {
|
||||
}
|
||||
++m_state;
|
||||
m_location = token->src_loc;
|
||||
+ m_stringify = (token->flags & STRINGIFY_ARG) != 0;
|
||||
return BEGIN;
|
||||
}
|
||||
else if (m_state == 1)
|
||||
@@ -234,6 +236,12 @@ class vaopt_state {
|
||||
return m_state == 0;
|
||||
}
|
||||
|
||||
+ /* Return true for # __VA_OPT__. */
|
||||
+ bool stringify () const
|
||||
+ {
|
||||
+ return m_stringify;
|
||||
+ }
|
||||
+
|
||||
private:
|
||||
|
||||
/* The cpp_reader. */
|
||||
@@ -247,6 +255,8 @@ class vaopt_state {
|
||||
/* If true, the previous token was ##. This is used to detect when
|
||||
a paste occurs at the end of the sequence. */
|
||||
bool m_last_was_paste;
|
||||
+ /* True for #__VA_OPT__. */
|
||||
+ bool m_stringify;
|
||||
|
||||
/* The state variable:
|
||||
0 means not parsing
|
||||
@@ -284,7 +294,8 @@ static _cpp_buff *collect_args (cpp_reader *, const cpp_hashnode *,
|
||||
static cpp_context *next_context (cpp_reader *);
|
||||
static const cpp_token *padding_token (cpp_reader *, const cpp_token *);
|
||||
static const cpp_token *new_string_token (cpp_reader *, uchar *, unsigned int);
|
||||
-static const cpp_token *stringify_arg (cpp_reader *, macro_arg *);
|
||||
+static const cpp_token *stringify_arg (cpp_reader *, const cpp_token **,
|
||||
+ unsigned int, bool);
|
||||
static void paste_all_tokens (cpp_reader *, const cpp_token *);
|
||||
static bool paste_tokens (cpp_reader *, location_t,
|
||||
const cpp_token **, const cpp_token *);
|
||||
@@ -818,10 +829,11 @@ cpp_quote_string (uchar *dest, const uchar *src, unsigned int len)
|
||||
return dest;
|
||||
}
|
||||
|
||||
-/* Convert a token sequence ARG to a single string token according to
|
||||
- the rules of the ISO C #-operator. */
|
||||
+/* Convert a token sequence FIRST to FIRST+COUNT-1 to a single string token
|
||||
+ according to the rules of the ISO C #-operator. */
|
||||
static const cpp_token *
|
||||
-stringify_arg (cpp_reader *pfile, macro_arg *arg)
|
||||
+stringify_arg (cpp_reader *pfile, const cpp_token **first, unsigned int count,
|
||||
+ bool va_opt)
|
||||
{
|
||||
unsigned char *dest;
|
||||
unsigned int i, escape_it, backslash_count = 0;
|
||||
@@ -834,9 +846,27 @@ stringify_arg (cpp_reader *pfile, macro_arg *arg)
|
||||
*dest++ = '"';
|
||||
|
||||
/* Loop, reading in the argument's tokens. */
|
||||
- for (i = 0; i < arg->count; i++)
|
||||
+ for (i = 0; i < count; i++)
|
||||
{
|
||||
- const cpp_token *token = arg->first[i];
|
||||
+ const cpp_token *token = first[i];
|
||||
+
|
||||
+ if (va_opt && (token->flags & PASTE_LEFT))
|
||||
+ {
|
||||
+ location_t virt_loc = pfile->invocation_location;
|
||||
+ const cpp_token *rhs;
|
||||
+ do
|
||||
+ {
|
||||
+ if (i == count)
|
||||
+ abort ();
|
||||
+ rhs = first[++i];
|
||||
+ if (!paste_tokens (pfile, virt_loc, &token, rhs))
|
||||
+ {
|
||||
+ --i;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ while (rhs->flags & PASTE_LEFT);
|
||||
+ }
|
||||
|
||||
if (token->type == CPP_PADDING)
|
||||
{
|
||||
@@ -923,7 +953,7 @@ paste_tokens (cpp_reader *pfile, location_t location,
|
||||
cpp_token *lhs;
|
||||
unsigned int len;
|
||||
|
||||
- len = cpp_token_len (*plhs) + cpp_token_len (rhs) + 1;
|
||||
+ len = cpp_token_len (*plhs) + cpp_token_len (rhs) + 2;
|
||||
buf = (unsigned char *) alloca (len);
|
||||
end = lhsend = cpp_spell_token (pfile, *plhs, buf, true);
|
||||
|
||||
@@ -949,8 +979,10 @@ paste_tokens (cpp_reader *pfile, location_t location,
|
||||
location_t saved_loc = lhs->src_loc;
|
||||
|
||||
_cpp_pop_buffer (pfile);
|
||||
- _cpp_backup_tokens (pfile, 1);
|
||||
- *lhsend = '\0';
|
||||
+
|
||||
+ unsigned char *rhsstart = lhsend;
|
||||
+ if ((*plhs)->type == CPP_DIV && rhs->type != CPP_EQ)
|
||||
+ rhsstart++;
|
||||
|
||||
/* We have to remove the PASTE_LEFT flag from the old lhs, but
|
||||
we want to keep the new location. */
|
||||
@@ -962,8 +994,10 @@ paste_tokens (cpp_reader *pfile, location_t location,
|
||||
/* Mandatory error for all apart from assembler. */
|
||||
if (CPP_OPTION (pfile, lang) != CLK_ASM)
|
||||
cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0,
|
||||
- "pasting \"%s\" and \"%s\" does not give a valid preprocessing token",
|
||||
- buf, cpp_token_as_text (pfile, rhs));
|
||||
+ "pasting \"%.*s\" and \"%.*s\" does not give "
|
||||
+ "a valid preprocessing token",
|
||||
+ (int) (lhsend - buf), buf,
|
||||
+ (int) (end - rhsstart), rhsstart);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1039,7 +1073,10 @@ paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs)
|
||||
abort ();
|
||||
}
|
||||
if (!paste_tokens (pfile, virt_loc, &lhs, rhs))
|
||||
- break;
|
||||
+ {
|
||||
+ _cpp_backup_tokens (pfile, 1);
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
while (rhs->flags & PASTE_LEFT);
|
||||
|
||||
@@ -1906,7 +1943,8 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro,
|
||||
if (src->flags & STRINGIFY_ARG)
|
||||
{
|
||||
if (!arg->stringified)
|
||||
- arg->stringified = stringify_arg (pfile, arg);
|
||||
+ arg->stringified = stringify_arg (pfile, arg->first, arg->count,
|
||||
+ false);
|
||||
}
|
||||
else if ((src->flags & PASTE_LEFT)
|
||||
|| (src != macro->exp.tokens && (src[-1].flags & PASTE_LEFT)))
|
||||
@@ -2029,7 +2067,24 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro,
|
||||
paste_flag = tokens_buff_last_token_ptr (buff);
|
||||
}
|
||||
|
||||
- if (src->flags & PASTE_LEFT)
|
||||
+ if (vaopt_tracker.stringify ())
|
||||
+ {
|
||||
+ unsigned int count
|
||||
+ = start ? paste_flag - start : tokens_buff_count (buff);
|
||||
+ const cpp_token *t
|
||||
+ = stringify_arg (pfile,
|
||||
+ start ? start + 1
|
||||
+ : (const cpp_token **) (buff->base),
|
||||
+ count, true);
|
||||
+ while (count--)
|
||||
+ tokens_buff_remove_last_token (buff);
|
||||
+ if (src->flags & PASTE_LEFT)
|
||||
+ copy_paste_flag (pfile, &t, src);
|
||||
+ tokens_buff_add_token (buff, virt_locs,
|
||||
+ t, t->src_loc, t->src_loc,
|
||||
+ NULL, 0);
|
||||
+ }
|
||||
+ else if (src->flags & PASTE_LEFT)
|
||||
{
|
||||
/* With a non-empty __VA_OPT__ on the LHS of ##, the last
|
||||
token should be flagged PASTE_LEFT. */
|
||||
@@ -3585,7 +3640,10 @@ create_iso_definition (cpp_reader *pfile)
|
||||
function-like macros when lexing the subsequent token. */
|
||||
if (macro->count > 1 && token[-1].type == CPP_HASH && macro->fun_like)
|
||||
{
|
||||
- if (token->type == CPP_MACRO_ARG)
|
||||
+ if (token->type == CPP_MACRO_ARG
|
||||
+ || (macro->variadic
|
||||
+ && token->type == CPP_NAME
|
||||
+ && token->val.node.node == pfile->spec_nodes.n__VA_OPT__))
|
||||
{
|
||||
if (token->flags & PREV_WHITE)
|
||||
token->flags |= SP_PREV_WHITE;
|
||||
--- gcc/testsuite/c-c++-common/cpp/va-opt-5.c
|
||||
+++ gcc/testsuite/c-c++-common/cpp/va-opt-5.c
|
||||
@@ -0,0 +1,67 @@
|
||||
+/* { dg-do run } */
|
||||
+/* { dg-options "-std=gnu99" { target c } } */
|
||||
+/* { dg-options "-std=c++20" { target c++ } } */
|
||||
+
|
||||
+#define lparen (
|
||||
+#define a0 fooa0
|
||||
+#define a1 fooa1 a0
|
||||
+#define a2 fooa2 a1
|
||||
+#define a3 fooa3 a2
|
||||
+#define a() b lparen )
|
||||
+#define b() c lparen )
|
||||
+#define c() d lparen )
|
||||
+#define g h
|
||||
+#define i(j) j
|
||||
+#define f(...) #__VA_OPT__(g i(0))
|
||||
+#define k(x,...) # __VA_OPT__(x) #x #__VA_OPT__(__VA_ARGS__)
|
||||
+#define l(x,...) #__VA_OPT__(a1 x)
|
||||
+#define m(x,...) "a()" #__VA_OPT__(a3 __VA_ARGS__ x ## __VA_ARGS__ ## x ## c a3) "a()"
|
||||
+#define n(x,...) = #__VA_OPT__(a3 __VA_ARGS__ x ## __VA_ARGS__ ## x ## c a3) #x #__VA_OPT__(a0 __VA_ARGS__ x ## __VA_ARGS__ ## x ## c a0) ;
|
||||
+#define o(x, ...) #__VA_OPT__(x##x x##x)
|
||||
+#define p(x, ...) #__VA_OPT__(_Pragma ("foobar"))
|
||||
+#define q(...) #__VA_OPT__(/* foo */x/* bar */)
|
||||
+const char *v1 = f();
|
||||
+const char *v2 = f(123);
|
||||
+const char *v3 = k(1);
|
||||
+const char *v4 = k(1, 2, 3 );
|
||||
+const char *v5 = l(a());
|
||||
+const char *v6 = l(a1 a(), 1);
|
||||
+const char *v7 = m();
|
||||
+const char *v8 = m(,);
|
||||
+const char *v9 = m(,a3);
|
||||
+const char *v10 = m(a3,a(),a0);
|
||||
+const char *v11 n()
|
||||
+const char *v12 n(,)
|
||||
+const char *v13 n(,a0)
|
||||
+const char *v14 n(a0, a(),a0)
|
||||
+const char *v15 = o(, 0);
|
||||
+const char *v16 = p(0);
|
||||
+const char *v17 = p(0, 1);
|
||||
+const char *v18 = q();
|
||||
+const char *v19 = q(1);
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ if (__builtin_strcmp (v1, "")
|
||||
+ || __builtin_strcmp (v2, "g i(0)")
|
||||
+ || __builtin_strcmp (v3, "1")
|
||||
+ || __builtin_strcmp (v4, "112, 3")
|
||||
+ || __builtin_strcmp (v5, "")
|
||||
+ || __builtin_strcmp (v6, "a1 fooa1 fooa0 b ( )")
|
||||
+ || __builtin_strcmp (v7, "a()a()")
|
||||
+ || __builtin_strcmp (v8, "a()a()")
|
||||
+ || __builtin_strcmp (v9, "a()a3 fooa3 fooa2 fooa1 fooa0 a3c a3a()")
|
||||
+ || __builtin_strcmp (v10, "a()a3 b ( ),fooa0 a3a(),a0a3c a3a()")
|
||||
+ || __builtin_strcmp (v11, "")
|
||||
+ || __builtin_strcmp (v12, "")
|
||||
+ || __builtin_strcmp (v13, "a3 fooa0 a0c a3a0 fooa0 a0c a0")
|
||||
+ || __builtin_strcmp (v14, "a3 b ( ),fooa0 a0a(),a0a0c a3a0a0 b ( ),fooa0 a0a(),a0a0c a0")
|
||||
+ || __builtin_strcmp (v15, "")
|
||||
+ || __builtin_strcmp (v16, "")
|
||||
+ || __builtin_strcmp (v17, "_Pragma (\"foobar\")")
|
||||
+ || __builtin_strcmp (v18, "")
|
||||
+ || __builtin_strcmp (v19, "x"))
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- gcc/testsuite/c-c++-common/cpp/va-opt-6.c
|
||||
+++ gcc/testsuite/c-c++-common/cpp/va-opt-6.c
|
||||
@@ -0,0 +1,17 @@
|
||||
+/* { dg-do preprocess } */
|
||||
+/* { dg-options "-std=gnu99" { target c } } */
|
||||
+/* { dg-options "-std=c++20" { target c++ } } */
|
||||
+
|
||||
+#define a ""
|
||||
+#define b(...) a ## #__VA_OPT__(1) /* { dg-error "pasting \"a\" and \"\"\"\" does not give a valid preprocessing token" } */
|
||||
+#define c(...) a ## #__VA_OPT__(1) /* { dg-error "pasting \"a\" and \"\"1\"\" does not give a valid preprocessing token" } */
|
||||
+#define d(...) #__VA_OPT__(1) ## !
|
||||
+#define e(...) #__VA_OPT__(1) ## !
|
||||
+#define f(...) #__VA_OPT__(. ## !)
|
||||
+#define g(...) #__VA_OPT__(. ## !)
|
||||
+b()
|
||||
+c(1)
|
||||
+d( ) /* { dg-error "pasting \"\"\"\" and \"!\" does not give a valid preprocessing token" } */
|
||||
+e( 1 ) /* { dg-error "pasting \"\"1\"\" and \"!\" does not give a valid preprocessing token" } */
|
||||
+f()
|
||||
+g(0) /* { dg-error "pasting \".\" and \"!\" does not give a valid preprocessing token" } */
|
58
gcc12-Wno-format-security.patch
Normal file
58
gcc12-Wno-format-security.patch
Normal file
@ -0,0 +1,58 @@
|
||||
2022-01-07 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* Makefile.tpl (GOCFLAGS, GDCFLAGS): Filter out -Wformat-security.
|
||||
* Makefile.in: Regenerated.
|
||||
|
||||
2017-02-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* configure.ac: When adding -Wno-format, also add -Wno-format-security.
|
||||
* configure: Regenerated.
|
||||
|
||||
--- gcc/configure.ac.jj 2017-02-13 12:20:53.000000000 +0100
|
||||
+++ gcc/configure.ac 2017-02-25 12:42:32.859175403 +0100
|
||||
@@ -480,7 +480,7 @@ AC_ARG_ENABLE(build-format-warnings,
|
||||
AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]),
|
||||
[],[enable_build_format_warnings=yes])
|
||||
AS_IF([test $enable_build_format_warnings = no],
|
||||
- [wf_opt=-Wno-format],[wf_opt=])
|
||||
+ [wf_opt="-Wno-format -Wno-format-security"],[wf_opt=])
|
||||
ACX_PROG_CXX_WARNING_OPTS(
|
||||
m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ],
|
||||
[-Wcast-qual -Wno-error=format-diag $wf_opt])),
|
||||
--- gcc/configure.jj 2017-02-13 12:20:52.000000000 +0100
|
||||
+++ gcc/configure 2017-02-25 12:42:50.041946391 +0100
|
||||
@@ -6647,7 +6647,7 @@ else
|
||||
fi
|
||||
|
||||
if test $enable_build_format_warnings = no; then :
|
||||
- wf_opt=-Wno-format
|
||||
+ wf_opt="-Wno-format -Wno-format-security"
|
||||
else
|
||||
wf_opt=
|
||||
fi
|
||||
--- Makefile.tpl.jj 2021-12-30 15:12:42.188164847 +0100
|
||||
+++ Makefile.tpl 2022-01-07 12:06:12.115550714 +0100
|
||||
@@ -447,8 +447,8 @@ LDFLAGS = @LDFLAGS@
|
||||
LIBCFLAGS = $(CFLAGS)
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
|
||||
-GOCFLAGS = $(CFLAGS)
|
||||
-GDCFLAGS = $(CFLAGS)
|
||||
+GOCFLAGS = $(filter-out -Wformat-security,$(CFLAGS))
|
||||
+GDCFLAGS = $(filter-out -Wformat-security,$(CFLAGS))
|
||||
|
||||
# Pass additional PGO and LTO compiler options to the PGO build.
|
||||
BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
|
||||
--- Makefile.in.jj 2021-12-30 15:12:42.188164847 +0100
|
||||
+++ Makefile.in 2022-01-07 12:06:27.335334561 +0100
|
||||
@@ -444,8 +444,8 @@ LDFLAGS = @LDFLAGS@
|
||||
LIBCFLAGS = $(CFLAGS)
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
|
||||
-GOCFLAGS = $(CFLAGS)
|
||||
-GDCFLAGS = $(CFLAGS)
|
||||
+GOCFLAGS = $(filter-out -Wformat-security,$(CFLAGS))
|
||||
+GDCFLAGS = $(filter-out -Wformat-security,$(CFLAGS))
|
||||
|
||||
# Pass additional PGO and LTO compiler options to the PGO build.
|
||||
BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
|
@ -7,16 +7,16 @@
|
||||
|
||||
--- gcc/toplev.c.jj 2008-12-09 23:59:10.000000000 +0100
|
||||
+++ gcc/toplev.c 2009-01-27 14:33:52.000000000 +0100
|
||||
@@ -117,6 +117,8 @@ static void compile_file (void);
|
||||
/* True if we don't need a backend (e.g. preprocessing only). */
|
||||
static bool no_backend;
|
||||
@@ -113,6 +113,8 @@ static void finalize (bool);
|
||||
static void crash_signal (int) ATTRIBUTE_NORETURN;
|
||||
static void compile_file (void);
|
||||
|
||||
+const char **toplev_main_argv;
|
||||
+
|
||||
/* Decoded options, and number of such options. */
|
||||
struct cl_decoded_option *save_decoded_options;
|
||||
unsigned int save_decoded_options_count;
|
||||
@@ -2287,6 +2289,8 @@ toplev::main (int argc, char **argv)
|
||||
@@ -2239,6 +2241,8 @@ toplev::main (int argc, char **argv)
|
||||
|
||||
expandargv (&argc, &argv);
|
||||
|
@ -4,7 +4,7 @@
|
||||
<a class="link" href="https://www.fsf.org" target="_top">FSF
|
||||
</a>
|
||||
</p><p>
|
||||
+ Release 11.2.1
|
||||
+ Release 12.0.0
|
||||
+ </p><p>
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation
|
||||
@ -17,7 +17,7 @@
|
||||
</p><p>
|
||||
- The API documentation, rendered into HTML, can be viewed online
|
||||
+ The API documentation, rendered into HTML, can be viewed locally
|
||||
+ <a class="link" href="api/index.html" target="_top">for the 11.2.1 release</a>,
|
||||
+ <a class="link" href="api/index.html" target="_top">for the 12.0.0 release</a>,
|
||||
+ online
|
||||
<a class="link" href="http://gcc.gnu.org/onlinedocs/" target="_top">for each GCC release</a>
|
||||
and
|
2
sources
2
sources
@ -1,4 +1,4 @@
|
||||
SHA512 (gcc-11.2.1-20211203.tar.xz) = 3cf64d3af541b9e80a2d5dd95a1257afefda554cfa16b757a7f861701e3da2d6917dbb1f4cd74301ffaf45e92c441642b8c589a10698a9103a216620f0849626
|
||||
SHA512 (gcc-12.0.0-20220108.tar.xz) = 4248211feab3970d24b0862ad61f8c089ae21311c2b56b2ac0a298cf9126b2255a4f8ba44677683bb5862e34e34d433e3c6a20747b55e242c57981fafc9e9641
|
||||
SHA512 (isl-0.18.tar.bz2) = 85d0b40f4dbf14cb99d17aa07048cdcab2dc3eb527d2fbb1e84c41b2de5f351025370e57448b63b2b8a8cf8a0843a089c3263f9baee1542d5c2e1cb37ed39d94
|
||||
SHA512 (newlib-cygwin-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.xz) = 002a48a7b689a81abbf16161bcaec001a842e67dfbe372e9e109092703bfc666675f16198f60ca429370e8850d564547dc505df81bc3aaca4ce6defbc014ad6c
|
||||
SHA512 (nvptx-tools-5f6f343a302d620b0868edab376c00b15741e39e.tar.xz) = f6d10db94fa1570ae0f94df073fa3c73c8e5ee16d59070b53d94f7db0de8a031bc44d7f3f1852533da04b625ce758e022263855ed43cfc6867e0708d001e53c7
|
||||
|
@ -3,5 +3,5 @@
|
||||
git clone --depth 1 git://gcc.gnu.org/git/gcc.git gcc-dir.tmp
|
||||
git --git-dir=gcc-dir.tmp/.git fetch --depth 1 origin $1
|
||||
d=`date --iso | sed 's/-//g'`
|
||||
git --git-dir=gcc-dir.tmp/.git archive --prefix=gcc-11.2.1-$d/ $1 | xz -9e > gcc-11.2.1-$d.tar.xz
|
||||
git --git-dir=gcc-dir.tmp/.git archive --prefix=gcc-12.0.0-$d/ $1 | xz -9e > gcc-12.0.0-$d.tar.xz
|
||||
rm -rf gcc-dir.tmp
|
||||
|
Loading…
Reference in New Issue
Block a user