Re: GCC/Clang attributes guiding warnings about unused entities

2023-04-28 Thread Stephan Bergmann via Gcc
On 4/28/23 11:55, Florian Weimer wrote: * Stephan Bergmann via Gcc: [cross-posting this to both the GCC and Clang communities] I don't see your post here: <https://discourse.llvm.org/search?expanded=true&q=unused%20after%3A2023-04-20> I don't think this is exp

GCC/Clang attributes guiding warnings about unused entities

2023-04-26 Thread Stephan Bergmann via Gcc
[cross-posting this to both the GCC and Clang communities] I have two specific issues on the subject I would like to discuss below. But first a quick overview: C++ has two attributes dealing with warnings about unused entities: * In one direction (making the compiler suppress warnings it wou

Re: More aggressive GCC 12 -Wmaybe-uninitialized when using

2021-07-23 Thread Stephan Bergmann via Gcc
On 22/07/2021 12:03, Jonathan Wakely wrote: This should fix it: [...] Thanks; it indeed fixed the LibreOffice build for me.

More aggressive GCC 12 -Wmaybe-uninitialized when using

2021-07-22 Thread Stephan Bergmann via Gcc
Compared to GCC 11 (at least gcc-c++-11.1.1-3.fc34.x86_64), recent GCC 12 trunk emits two "unhelpful" -Wmaybe-uninitialized for $ cat test.cc #include using fn = std::function; fn f(fn x) { fn a; a = x; return x; } $ ~/gcc/trunk/inst/bin/g++ -c -Wmaybe-uninitialized -O2 test.cc

libstdc++: ODR violation when using std::regex with and without -D_GLIBCXX_DEBUG

2018-05-08 Thread Stephan Bergmann
I was recently bitten by the following issue (Linux, libstdc++ 8.0.1): A process loads two dynamic libraries A and B both using std::regex, and A is compiled without -D_GLIBCXX_DEBUG while B is compiled with -D_GLIBCXX_DEBUG. B creates an instance of std::regex, which internally creates a std

Re: gdb 8.x - g++ 7.x compatibility

2018-02-05 Thread Stephan Bergmann
On 05.02.2018 06:06, Simon Marchi wrote: On 2018-02-04 02:17 PM, Martin Sebor wrote: Printing the suffix is unhelpful because it leads to unnecessary differences in diagnostics (even in non-template contexts). For templates with non-type template parameters there is no difference between, say A

Re: typeid name of non-throwing function type

2017-12-21 Thread Stephan Bergmann
On 12/21/2017 07:52 AM, Stephan Bergmann wrote: Thinking a bit more about it, I think that's rather a bug in GCC, right? ~ cat test72.cc #include #include void f1(); void f2() noexcept; int main() { std::cout << (typeid(f1) == typeid(f2)) << '\n'; } ~ g++ -std=

Re: typeid name of non-throwing function type

2017-12-20 Thread Stephan Bergmann
On 12/20/2017 03:48 PM, Stephan Bergmann wrote: I see with any recent GCC (when targeting the Itanium C++ ABI), $ cat test.cc #include #include void f() noexcept; int main() { std::cout << typeid(f).name() << '\n'; } $ g++ -std=c++17 test.cc $ ./a.out FvvE th

typeid name of non-throwing function type

2017-12-20 Thread Stephan Bergmann
I see with any recent GCC (when targeting the Itanium C++ ABI), $ cat test.cc #include #include void f() noexcept; int main() { std::cout << typeid(f).name() << '\n'; } $ g++ -std=c++17 test.cc $ ./a.out FvvE that the function type's mangling doesn't contain the noexcept specifier (in whic

Re: New GCC 7 -Wformat-truncation suppressed by (and only by) -Og?

2017-02-23 Thread Stephan Bergmann
On 02/23/2017 05:02 PM, Martin Sebor wrote: On 02/23/2017 06:51 AM, Stephan Bergmann wrote: At least with a recent GCC 7 trunk build ("gcc (GCC) 7.0.1 20170221 (experimental)"), I noticed that -Wformat-truncation warnings happen to not be emitted if and only if -Og is given

Re: New GCC 7 -Wformat-truncation suppressed by (and only by) -Og?

2017-02-23 Thread Stephan Bergmann
On 02/23/2017 02:51 PM, Stephan Bergmann wrote: At least with a recent GCC 7 trunk build ("gcc (GCC) 7.0.1 20170221 (experimental)"), I noticed that -Wformat-truncation warnings happen to not be emitted if and only if -Og is given: $ cat test.c #include int main() {

New GCC 7 -Wformat-truncation suppressed by (and only by) -Og?

2017-02-23 Thread Stephan Bergmann
At least with a recent GCC 7 trunk build ("gcc (GCC) 7.0.1 20170221 (experimental)"), I noticed that -Wformat-truncation warnings happen to not be emitted if and only if -Og is given: $ cat test.c #include int main() { char buf[3]; snprintf(buf, sizeof buf, "%s", "foo"); return 0;

Re: Disable -std=c++17 "ISO C++1z does not allow dynamic exception specifications"?

2017-02-21 Thread Stephan Bergmann
On 02/21/2017 03:56 PM, Jonathan Wakely wrote: On 21 February 2017 at 14:55, Jonathan Wakely wrote: On 21 February 2017 at 14:51, Jakub Jelinek wrote: On Tue, Feb 21, 2017 at 03:44:17PM +0100, Stephan Bergmann wrote: There is no flag to suppress that error or demote it to a warning, is there

Disable -std=c++17 "ISO C++1z does not allow dynamic exception specifications"?

2017-02-21 Thread Stephan Bergmann
There is no flag to suppress that error or demote it to a warning, is there? Could be useful when adapting large code bases to C++17 incrementally.

Re: abi_tag questions

2015-11-09 Thread Stephan Bergmann
On 11/04/2015 12:48 PM, Jonathan Wakely wrote: On 4 November 2015 at 14:37, Stephan Bergmann wrote: I have two questions regarding the abi_tag attribute (as documented at <https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html>): [...] 2 "The argument can be a list of

Re: abi_tag questions

2015-11-04 Thread Stephan Bergmann
On 11/04/2015 12:50 PM, Jonathan Wakely wrote: On 4 November 2015 at 17:18, Jonathan Wakely wrote: On 4 November 2015 at 14:37, Stephan Bergmann wrote: I have two questions regarding the abi_tag attribute (as documented at <https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.h

abi_tag questions

2015-11-04 Thread Stephan Bergmann
I have two questions regarding the abi_tag attribute (as documented at ): 1 "The attribute can also be applied to an inline namespace, but does not affect the mangled name of the namespace; in this case it is only used for -Wabi

C++ name mangling not tracking extern "C"-ness of function types?

2014-06-26 Thread Stephan Bergmann
Quoting gcc/cp/mangle.c@34394: /* Non-terminal . NODE is a FUNCTION_TYPE or METHOD_TYPE. If INCLUDE_RETURN_TYPE is non-zero, the return type is mangled before the parameter types. ::= F [Y] E */ static void write_function_type (type, include_return_type) tree type; i

Broken link Extended-asm-with-goto.html#Extended-asm-with-goto in online HTML documentation

2013-06-06 Thread Stephan Bergmann
Not sure if it is already known, but noticed that at least in the online HTML documentation for all versions since 4.5 (where it was apparently introduced), at in the paragraph Speaking of labels, jumps from one asm to another

Re: How does _ZNSs4_Rep20_S_empty_rep_storageE (not) become a unique global symbol?

2013-02-20 Thread Stephan Bergmann
On 02/19/2013 07:22 PM, Florian Weimer wrote: On 02/19/2013 07:06 PM, Stephan Bergmann wrote: I'm puzzled by the following on Linux, where I don't understand what causes it that a given symbol is exported as "u" (when viewed with nm, which documents "u" as "a

How does _ZNSs4_Rep20_S_empty_rep_storageE (not) become a unique global symbol?

2013-02-19 Thread Stephan Bergmann
I'm puzzled by the following on Linux, where I don't understand what causes it that a given symbol is exported as "u" (when viewed with nm, which documents "u" as "a unique global symbol. This is a GNU extension...") or not: * On an older toolchain (SLED 11 with GCC 4.3.4 and binutils 2.21.1),

Re: C++98/C++11 ABI compatibility for gcc-4.7

2012-06-18 Thread Stephan Bergmann
On 06/15/2012 10:12 PM, James Y Knight wrote: Whether or not this particular incompatibility was intended or not, the point remains. You cannot say that GCC devs are taking the C++11 binary incompatibility issue seriously while: a) there exist serious ABI incompatibilities between the modes. b) t

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Stephan Bergmann
On 03/29/2012 04:12 PM, Andrew Haley wrote: On 03/29/2012 02:59 PM, Michael Matz wrote: Actually, with -fnon-call-exceptions volatile asms are already supposed to be throwing. It's just that this got lost with tree-ssa. With the patch and -fnon-call-exceptions a simple "__asm__ volatile (...)"

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Stephan Bergmann
On 03/29/2012 11:16 AM, Richard Guenther wrote: On Thu, Mar 29, 2012 at 10:47 AM, Stephan Bergmann wrote: So an explicit -fnon-call-exceptions on the command line seems to indeed help. Unfortunately, moving that into a #pragma GCC optimize ("non-call-exceptions") at the top of

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Stephan Bergmann
On 03/29/2012 09:44 AM, Jakub Jelinek wrote: On Thu, Mar 29, 2012 at 09:05:29AM +0200, Stephan Bergmann wrote: In LibreOffice's ever-beloved low-level code to synthesize calls to C++ virtual functions, I'm having the following problem (on Linux x86_64). The function callVirtualMetho

C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Stephan Bergmann
Hi all, In LibreOffice's ever-beloved low-level code to synthesize calls to C++ virtual functions, I'm having the following problem (on Linux x86_64). The function callVirtualMethod at

Re: Linker stumbles over non-grouped .text/.rodata for a C++ function

2011-08-31 Thread Stephan Bergmann
On Aug 31, 2011, at 10:07 PM, Ian Lance Taylor wrote: > Stephan Bergmann writes: > >> I am trying to track down an error that can at least be observed when >> building recent versions of LibreOffice (e.g., revision >> bf3ff35d8c96315c35cf8dc8495

Linker stumbles over non-grouped .text/.rodata for a C++ function

2011-08-31 Thread Stephan Bergmann
I am trying to track down an error that can at least be observed when building recent versions of LibreOffice (e.g., revision bf3ff35d8c96315c35cf8dc8495be4b488b55cb6 of git://anongit.freedesktop.org/libreoffice/core) on Fedora 15 i386 (i.e., with GCC 4.6.0 20110603 (Red Hat 4.6.0-10)). The pr

libgcc_s.so.1 exception handling behaviour depending on glibc version

2005-05-18 Thread Stephan Bergmann
Hi all, I experience the following problem on Linux x86: I have one version of GCC, call it C1, compiled on a glibc 2.2 (plain 2.2, that is) machine. (It happens to be GCC 3.4.1, but the exact version is probably irrelevant.) This build includes a version of libgcc_s.so.1. Additionally, I hav