public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Mikolaj Zalewski <mikolajz@google.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] gold: add cast to gold_unreachable to workaround gcc giving  	invalid "no return statement" warnings
Date: Fri, 14 Aug 2009 08:34:00 -0000	[thread overview]
Message-ID: <m3tz0a7q0d.fsf@google.com> (raw)
In-Reply-To: <7ebec9e70908130809n1eadef26o479906b6e228caea@mail.gmail.com> (Mikolaj Zalewski's message of "Thu\, 13 Aug 2009 17\:09\:00 +0200")

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]

Mikolaj Zalewski <mikolajz@google.com> writes:

>   I couldn't compile gold today because of the "no return statement"
> warning when using gold_unreachable. At
> http://gcc.gnu.org/ml/gcc-bugs/2007-11/msg01605.html I've found a
> workaround that should work for gcc >= 3.4. Such a patch that affects
> only gold_unreachable is ok?
>
> 2009-08-13  Mikolaj Zalewski  <mikolajz@google.com>
>
> 	* gold.h (gold_unreachable): Add a cast.

I would prefer a patch like this one, which gives us a way to clean it
up a few years down the road.  Could you check whether this solves the
problem for you?  If it does, I'll commit it.  Thanks.

Ian


2009-08-14  Ian Lance Taylor  <iant@google.com>

	* gold.h (FUNCTION_NAME): Define.
	(gold_unreachable): Use FUNCTION_NAME.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Avoid gcc bug --]
[-- Type: text/x-patch, Size: 1198 bytes --]

Index: gold.h
===================================================================
RCS file: /cvs/src/src/gold/gold.h,v
retrieving revision 1.39
diff -p -u -r1.39 gold.h
--- gold.h	5 Aug 2009 20:51:56 -0000	1.39
+++ gold.h	14 Aug 2009 08:30:51 -0000
@@ -253,11 +253,22 @@ gold_undefined_symbol_at_location(const 
 extern void
 gold_nomem() ATTRIBUTE_NORETURN;
 
+// In versions of gcc before 4.3, using __FUNCTION__ in a template
+// function can cause gcc to get confused about whether or not the
+// function can return.  See http://gcc.gnu.org/PR30988.  Use a macro
+// to avoid the problem.  This can be removed when we no longer need
+// to care about gcc versions before 4.3.
+#if defined(__GNUC__) && GCC_VERSION < 4003
+#define FUNCTION_NAME static_cast<const char*>(__FUNCTION__)
+#else 
+#define FUNCTION_NAME __FUNCTION__
+#endif
+
 // This macro and function are used in cases which can not arise if
 // the code is written correctly.
 
 #define gold_unreachable() \
-  (gold::do_gold_unreachable(__FILE__, __LINE__, __FUNCTION__))
+  (gold::do_gold_unreachable(__FILE__, __LINE__, FUNCTION_NAME))
 
 extern void do_gold_unreachable(const char*, int, const char*)
   ATTRIBUTE_NORETURN;

  reply	other threads:[~2009-08-14  8:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-13 15:09 Mikolaj Zalewski
2009-08-14  8:34 ` Ian Lance Taylor [this message]
2009-08-14  9:28   ` Mikolaj Zalewski
2009-08-14  9:36     ` Ian Lance Taylor
2009-08-31 21:49 ` [PATCH] Gold: Added R_ARM_ABS8 relocation Viktor Kutuzov
2009-08-31 23:52   ` Gold: Testsuite Viktor Kutuzov
2009-09-01  0:46     ` Ian Lance Taylor
2009-09-01  1:02       ` Viktor Kutuzov
2009-09-01  2:10         ` Ian Lance Taylor
     [not found]           ` <6AE1604EE3EC5F4296C096518C6B77EEE56FBF60@mail.accesssoftek.com>
2009-09-02  1:31             ` Viktor Kutuzov
2009-09-01  0:56   ` [PATCH] Gold: Added R_ARM_ABS8 relocation Ian Lance Taylor
2009-09-01 19:53     ` [PATCH Take 2] " Viktor Kutuzov
2009-09-01 21:24       ` Ian Lance Taylor
2009-09-02  1:30         ` [PATCH] Gold: Added R_ARM_ABS8 relocation unit test Viktor Kutuzov
2009-09-16  0:23           ` [PATCH] Gold: Added R_ARM_GOT_PREL relocation and unit tests Viktor Kutuzov
2009-09-16  1:00             ` [Gold] Heads up. Working on interworking Viktor Kutuzov
2009-10-06 21:46               ` [GOLD] Heads up. Gold for mingw Viktor Kutuzov
2009-10-06 22:02                 ` Vincent R.
2009-10-06 22:26                   ` Viktor Kutuzov
2009-10-06 22:06                 ` Matt Rice
2009-10-07 15:31             ` [PATCH] Gold: Added R_ARM_GOT_PREL relocation and unit tests Ian Lance Taylor
     [not found]         ` <6AE1604EE3EC5F4296C096518C6B77EEE56FBF62@mail.accesssoftek.com>
2009-09-03 23:26           ` [PATCH, Take 2] Gold: Added R_ARM_ABS8 relocation unit test Viktor Kutuzov
2009-09-27  7:35             ` Ian Lance Taylor
2009-09-29 23:30               ` Viktor Kutuzov
2009-09-29 23:40                 ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3tz0a7q0d.fsf@google.com \
    --to=iant@google.com \
    --cc=binutils@sourceware.org \
    --cc=mikolajz@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).