Patchwork add attribute((noreturn)) to romcc

login
register
about
Submitter Stefan Reinauer
Date 2010-02-28 17:31:24
Message ID <4B8AA86C.70708@coresystems.de>
Download mbox | patch
Permalink /patch/992/
State Accepted
Commit r5172
Headers show

Comments

Stefan Reinauer - 2010-02-28 17:31:24
It doesn't do anything, but it allows the same code to be compiled with
gcc and romcc.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
ron minnich - 2010-02-28 17:35:29
Acked-by: Ronald G. Minnich <rminnich@gmail.com>

Patch

Index: util/romcc/romcc.c
===================================================================
--- util/romcc/romcc.c	(revision 5154)
+++ util/romcc/romcc.c	(working copy)
@@ -1083,6 +1083,7 @@ 
 	struct hash_entry *i_break;
 	struct hash_entry *i_default;
 	struct hash_entry *i_return;
+	struct hash_entry *i_noreturn;
 	/* Additional hash entries for predefined macros */
 	struct hash_entry *i_defined;
 	struct hash_entry *i___VA_ARGS__;
@@ -12758,6 +12759,9 @@ 
 			}
 			attributes |= ATTRIB_ALWAYS_INLINE;
 		}
+		else if (ident == state->i_noreturn) {
+			// attribute((noreturn)) does nothing (yet?)
+		}
 		else {
 			error(state, 0, "Unknown attribute:%s", ident->name);
 		}
@@ -24994,6 +24998,7 @@ 
 	/* Memorize where some attribute keywords are. */
 	state.i_noinline      = lookup(&state, "noinline", 8);
 	state.i_always_inline = lookup(&state, "always_inline", 13);
+	state.i_noreturn      = lookup(&state, "noreturn", 8);
 
 	/* Process the command line macros */
 	process_cmdline_macros(&state);