delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2009/04/09/05:44:14

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Date: Thu, 09 Apr 2009 12:41:51 +0300
From: Eli Zaretskii <eliz AT gnu DOT org>
Subject: Re: [PATCH] dbgcom.c, attribute patch
In-reply-to: <647fe9b10904082358r38772fcco8708468aa931f5a2@mail.gmail.com>
X-012-Sender: halo1 AT inter DOT net DOT il
To: Ozkan Sezer <sezeroz AT gmail DOT com>
Cc: djgpp-workers AT delorie DOT com
Message-id: <83ljqa410g.fsf@gnu.org>
References: <647fe9b10904082358r38772fcco8708468aa931f5a2 AT mail DOT gmail DOT com>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Thu, 9 Apr 2009 09:58:31 +0300
> From: Ozkan Sezer <sezeroz AT gmail DOT com>
> 
> src/debug/common/dbgcom.c:  __attribute__((used)) for static data is OK
> for gcc-3.3, too, not just for gcc >= 3.4.  Patch attached, please consider
> for applying.

Thanks, but why did you make these patches so unnecessarily complex?
The C #if preprocessor directive allows arbitrary boolean expressions,
not just a single symbol.  Also, what is the purpose of renaming
__attribute_used into __used?

So I would suggest this instead:


--- dbgcom.c.orig	2009-04-09 12:38:53.687500000 +0300
+++ dbgcom.c	2009-04-09 12:38:22.312500000 +0300
@@ -35,8 +35,10 @@
 #include <sys/fsext.h>
 #include <io.h>
 
-#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))
+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))
 # define __attribute_used __attribute__ ((__used__))
+#elif __GNUC__ >= 2
+# define __attribute_used __attribute__((__unused__))
 #else
 # define __attribute_used
 #endif

Does this work for you?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019