public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14391] New: -fno-weak vs. __GXX_WEAK__
@ 2004-03-02 21:48 bkoz at gcc dot gnu dot org
  2004-03-03  4:03 ` [Bug c++/14391] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-03-02 21:48 UTC (permalink / raw)
  To: gcc-bugs

I'd like to be able to test, on linux, what it's like for those poor souls that
use g++/libstdc++ without support for weak symbols. Suckers!

Look for -fno-weak:
http://gcc.gnu.org/onlinedocs/gcc/C---Dialect-Options.html#C++%20Dialect%20Options

Yeah, this works, linkage-wise. However, using -fno-weak on linux doesn't
undefine __GXX_WEAK__, which makes it less useful for me, since this is what the
libstc++ tests use to determine if the active compiler actually use weak symbols.

ie, this fails on linux:

g++ -fno-weak test.cc

test.cc:
#if !defined(__GXX_WEAK__)
#error should_be_here
#else
#error should_not_be_here
#endif

gives:

#error should_not_be_here

This has been broken since at least 3.3.2.

-benjamin

-- 
           Summary: -fno-weak vs. __GXX_WEAK__
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14391


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/14391] -fno-weak vs. __GXX_WEAK__
  2004-03-02 21:48 [Bug c++/14391] New: -fno-weak vs. __GXX_WEAK__ bkoz at gcc dot gnu dot org
@ 2004-03-03  4:03 ` pinskia at gcc dot gnu dot org
  2004-03-03 17:24 ` bkoz at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-03  4:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-03 04:02 -------
Confirmed, this patch should work (could you sumbit if it works for you?):
Index: c-cppbuiltin.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/c-cppbuiltin.c,v
retrieving revision 1.7.4.6
diff -u -p -r1.7.4.6 c-cppbuiltin.c
--- c-cppbuiltin.c      30 Jan 2004 13:13:30 -0000      1.7.4.6
+++ c-cppbuiltin.c      3 Mar 2004 04:01:25 -0000
@@ -296,7 +296,7 @@ c_cpp_builtins (cpp_reader *pfile)
 
   if (c_dialect_cxx ())
     {
-      if (SUPPORTS_ONE_ONLY)
+      if (SUPPORTS_ONE_ONLY  && !flag_weak)
        cpp_define (pfile, "__GXX_WEAK__=1");
       else
        cpp_define (pfile, "__GXX_WEAK__=0");

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-03 04:03:00
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14391


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/14391] -fno-weak vs. __GXX_WEAK__
  2004-03-02 21:48 [Bug c++/14391] New: -fno-weak vs. __GXX_WEAK__ bkoz at gcc dot gnu dot org
  2004-03-03  4:03 ` [Bug c++/14391] " pinskia at gcc dot gnu dot org
@ 2004-03-03 17:24 ` bkoz at gcc dot gnu dot org
  2005-05-01 20:35 ` pinskia at gcc dot gnu dot org
  2005-05-01 22:21 ` cvs-commit at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-03-03 17:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at gcc dot gnu dot org  2004-03-03 17:24 -------

Sadly, this patch does not work for me.

-benjamin

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14391


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/14391] -fno-weak vs. __GXX_WEAK__
  2004-03-02 21:48 [Bug c++/14391] New: -fno-weak vs. __GXX_WEAK__ bkoz at gcc dot gnu dot org
  2004-03-03  4:03 ` [Bug c++/14391] " pinskia at gcc dot gnu dot org
  2004-03-03 17:24 ` bkoz at gcc dot gnu dot org
@ 2005-05-01 20:35 ` pinskia at gcc dot gnu dot org
  2005-05-01 22:21 ` cvs-commit at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-01 20:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-01 20:35 -------
(In reply to comment #1)
> Confirmed, this patch should work (could you sumbit if it works for you?):
Looks like I had messed up the logic and the !flag_weak should have been just flag_weak.
Anyways this has been fixed by:
	* c-cppbuiltin.c (c_cpp_builtins): Do not define __GXX_WEAK__ to 1
	if !flag_weak.
	* doc/cpp.texi (__DEPRECATED): Document.
	(__EXCEPTIONS): Likewise.
	(__GXX_WEAK__): Likewise.
	
	* g++.dg/cpp/weak.C: New test.


See <http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00042.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14391


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/14391] -fno-weak vs. __GXX_WEAK__
  2004-03-02 21:48 [Bug c++/14391] New: -fno-weak vs. __GXX_WEAK__ bkoz at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-05-01 20:35 ` pinskia at gcc dot gnu dot org
@ 2005-05-01 22:21 ` cvs-commit at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-01 22:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-01 22:21 -------
Subject: Bug 14391

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2005-05-01 22:21:00

Modified files:
	gcc            : ChangeLog 

Log message:
	2005-05-01  Mark Mitchell  <mark@codesourcery.com>
	
	PR C++/14391
	* c-cppbuiltin.c (c_cpp_builtins): Do not define __GXX_WEAK__ to 1
	if !flag_weak.
	* doc/cpp.texi (__DEPRECATED): Document.
	(__EXCEPTIONS): Likewise.
	(__GXX_WEAK__): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8549&r2=2.8550



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14391


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-05-01 22:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-02 21:48 [Bug c++/14391] New: -fno-weak vs. __GXX_WEAK__ bkoz at gcc dot gnu dot org
2004-03-03  4:03 ` [Bug c++/14391] " pinskia at gcc dot gnu dot org
2004-03-03 17:24 ` bkoz at gcc dot gnu dot org
2005-05-01 20:35 ` pinskia at gcc dot gnu dot org
2005-05-01 22:21 ` cvs-commit at gcc dot gnu dot org

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).