delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2011/07/10/11:32:32

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=mime-version:date:message-id:subject:from:to:content-type;
bh=eyb/Bpim/I9pGXRt+VSFlZ1T6y1kpO+4q7GwVn0pgik=;
b=aj4UCIzR7UNIP5/dgfDhdPCBHyvMpyfm0L2xhqgnn6D8ETs0aCuOvnOt4vsJ8sPN9G
h9UqjrlzTea1MQiYKHpSXw3XbcyfZCzn+dFA2TR/DKiXfEw9YWVQAnj2PamLdwNxsyxh
GS7FI66sKaIAEPAOft8ygTxWQrvlsv0e507GM=
MIME-Version: 1.0
Date: Sun, 10 Jul 2011 18:32:03 +0300
Message-ID: <CAA2C=vCzxuxuMdBfJO3mdoc2OQpKw5cJ_ywLm6bwazFz5uVGQA@mail.gmail.com>
Subject: longjmp not marked with noreturn attribute
From: Ozkan Sezer <sezeroz AT gmail DOT com>
To: djgpp-workers AT delorie DOT com
Reply-To: djgpp-workers AT delorie DOT com

The setjmp.h from djgpp does not mark longjmp() as noreturn,
therefore, g++ warns upon seeing a function who is calling longjmp()
and marked as noreturn:
host.c: In function 'void Host_Error(const char*, ...)':
host.c:226: warning: 'noreturn' function does return
The Host_Error() function in question is like:
void Host_Error (const char *error, ...)
{
[... stuff ...]
	longjmp (host_abortserver, 1);
}

So, I suggest something like the following:

--- setjmp.h.orig	2003-02-04 22:24:11.000000000 +0200
+++ setjmp.h	2011-07-10 18:21:40.000000000 +0300
@@ -22,7 +22,7 @@ typedef struct __jmp_buf {
   unsigned char __fpu_state[108]; /* for future use */
 } jmp_buf[1];

-void	longjmp(jmp_buf env, int val);
+void	longjmp(jmp_buf env, int val) __attribute__((__noreturn__));
 int	setjmp(jmp_buf env);
 #define setjmp setjmp   /* required by C++ standard */


Regards.

--
Ozkan

- Raw text -


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