This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] gold: add cast to gold_unreachable to workaround gcc giving invalid "no return statement" warnings
- From: Mikolaj Zalewski <mikolajz at google dot com>
- To: binutils at sourceware dot org
- Date: Thu, 13 Aug 2009 17:09:00 +0200
- Subject: [PATCH] gold: add cast to gold_unreachable to workaround gcc giving invalid "no return statement" warnings
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.
From 2c4c78358538c7b260a2d23a66add87e28d9a1ad Mon Sep 17 00:00:00 2001
From: Mikolaj Zalewski <mikolajz@google.com>
Date: Thu, 13 Aug 2009 16:56:44 +0200
Subject: [PATCH] gold: add cast to gold_unreachable to workaround gcc giving invalid "no return statement" warnings
---
gold/gold.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/gold/gold.h b/gold/gold.h
index 1319699..3c9971d 100644
--- a/gold/gold.h
+++ b/gold/gold.h
@@ -255,9 +255,11 @@ gold_nomem() ATTRIBUTE_NORETURN;
// This macro and function are used in cases which can not arise if
// the code is written correctly.
+// Note: the cast of __FUNCTION__ is needed to workaround gcc bug
+// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30988 causing invalid warnings.
#define gold_unreachable() \
- (gold::do_gold_unreachable(__FILE__, __LINE__, __FUNCTION__))
+ (gold::do_gold_unreachable(__FILE__, __LINE__, (const char *)__FUNCTION__))
extern void do_gold_unreachable(const char*, int, const char*)
ATTRIBUTE_NORETURN;
--
1.5.4.3