From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15312 invoked by alias); 14 Jun 2012 20:06:53 -0000 Received: (qmail 15293 invoked by uid 22791); 14 Jun 2012 20:06:51 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED,TW_GM X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Jun 2012 20:06:38 +0000 From: "pluto at agmk dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53673] Add magic weak symbol to indicate C++ standard setting (C++03, C++11 etc) to help debug ABI problems Date: Thu, 14 Jun 2012 20:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pluto at agmk dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-06/txt/msg00951.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53673 Pawel Sikora changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pluto at agmk dot net --- Comment #2 from Pawel Sikora 2012-06-14 20:06:15 UTC --- (In reply to comment #0) > Can we have a magic weak symbol output by G++ into compilands saying what -std > setting was used? For example: > > No -std outputs __gplusplus_std_cpluscplus98 > -std=c++03 outputs __gplusplus_std_cplusplus03 > -std=gnu++03 outputs __gplusplus_std_gnu03 > -std=c++11 outputs __gplusplus_std_cplusplus11 > -std=gnu++11 outputs __gplusplus_std_gnu11 > ... and so on ... > > Why? Because right now it's too easy to accidentally link object files compiled > with 98 with those compiled with 11 and not then know why things spontaneously > fail: > > http://gcc.gnu.org/ml/gcc/2012-06/msg00201.html > http://gcc.gnu.org/wiki/Cxx11AbiCompatibility > > If __gplusplus_std_cpluscplus98 and __gplusplus_std_cplusplus11 both turn up in > a shared object or executable, then we know we have combined 98 and 11 built > code. Indeed, a future ld could warn if this happens. > > Niall you can use -frecord-gcc-switches to detect mixed objects in linked library.