From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14724 invoked by alias); 11 Jan 2012 20:59:28 -0000 Received: (qmail 14715 invoked by uid 22791); 11 Jan 2012 20:59:28 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.fgznet.ch (HELO smtp.fgznet.ch) (81.92.96.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 20:59:14 +0000 Received: from deuterium.andreas.nets (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id q0BKsUMu083643 for ; Wed, 11 Jan 2012 21:54:31 +0100 (CET) (envelope-from andreast-list@fgznet.ch) Message-ID: <4F0DF81F.3040905@fgznet.ch> Date: Wed, 11 Jan 2012 20:59:00 -0000 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch] make static_assert gdb private Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00369.txt.bz2 Hi all, I regularly build gdb-cvs on FreeBSD and recently we updated some system headers to be C11 'prepared'. Namely assert.h got a definition for static_assert. This gives now a collision when I build gdb-cvs, in mi/mi-common.c where we use the static_assert from gdb_assert.h To workaround I gave a prefix gdb_ to the static_assert from gdb_assert.h. This lets me build gdb again. The C11 static_assert is not FreeBSD only, I found that in the glibc repo this static_assert is also defined. So I expect sooner or later that GNU/Linux also complains about redefinition of static_assert. Below is the patch I have in my local tree. Is this ok for trunk? Thanks, Andreas 2012-01-11 Andreas Tobler * common/gdb_assert.h (gdb_static_assert): Rename static_assert to an internal gdb_static_assert. * mi/mi-common.c: Rename static_assert to gdb_static_assert. Index: common/gdb_assert.h =================================================================== RCS file: /cvs/src/src/gdb/common/gdb_assert.h,v retrieving revision 1.3 diff -u -r1.3 gdb_assert.h --- common/gdb_assert.h 4 Jan 2012 08:17:18 -0000 1.3 +++ common/gdb_assert.h 11 Jan 2012 20:51:42 -0000 @@ -22,7 +22,7 @@ /* A static assertion. This will cause a compile-time error if EXPR, which must be a compile-time constant, is false. */ -#define static_assert(expr) \ +#define gdb_static_assert(expr) \ extern int never_defined_just_used_for_checking[(expr) ? 1 : -1] /* PRAGMATICS: "gdb_assert.h":gdb_assert() is a lower case (rather Index: mi/mi-common.c =================================================================== RCS file: /cvs/src/src/gdb/mi/mi-common.c,v retrieving revision 1.12 diff -u -r1.12 mi-common.c --- mi/mi-common.c 4 Jan 2012 08:17:24 -0000 1.12 +++ mi/mi-common.c 11 Jan 2012 20:51:42 -0000 @@ -43,7 +43,7 @@ NULL }; -static_assert (ARRAY_SIZE (async_reason_string_lookup) == EXEC_ASYNC_LAST + 1); +gdb_static_assert (ARRAY_SIZE (async_reason_string_lookup) == EXEC_ASYNC_LAST + 1); const char * async_reason_lookup (enum async_reply_reason reason)