Skip to content
Snippets Groups Projects
Commit 178d2a76 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[printer] use attribute payload to pretty-print _Noreturn when relevant

a _noreturn attribute with c11 tag will be rendered as _Noreturn keyword
parent c67ca4c5
No related branches found
No related tags found
No related merge requests found
...@@ -1116,7 +1116,8 @@ decl_spec_wo_type: /* ISO 6.7 */ ...@@ -1116,7 +1116,8 @@ decl_spec_wo_type: /* ISO 6.7 */
| REGISTER { SpecStorage REGISTER, $1} | REGISTER { SpecStorage REGISTER, $1}
/* ISO 6.7.4 */ /* ISO 6.7.4 */
| INLINE { SpecInline, $1 } | INLINE { SpecInline, $1 }
| NORETURN { SpecAttr (("noreturn",[])), $1 } | NORETURN { SpecAttr
(("noreturn",[make_expr (VARIABLE "c11")])), $1 }
| cvspec { $1 } | cvspec { $1 }
| attribute_nocv { SpecAttr (fst $1), snd $1 } | attribute_nocv { SpecAttr (fst $1), snd $1 }
; ;
......
...@@ -2115,6 +2115,9 @@ class cil_printer () = object (self) ...@@ -2115,6 +2115,9 @@ class cil_printer () = object (self)
not state.print_cil_as_is && not state.print_cil_as_is &&
not (Kernel.is_debug_key_enabled Kernel.dkey_print_bitfields) -> not (Kernel.is_debug_key_enabled Kernel.dkey_print_bitfields) ->
false false
| "noreturn", [ ACons ("c11",[]) ]
when not state.print_cil_as_is ->
fprintf fmt "_Noreturn"; false
| _ -> (* This is the default case *) | _ -> (* This is the default case *)
(* Add underscores to the name *) (* Add underscores to the name *)
let an' = let an' =
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
[kernel] tests/syntax/built.i:21: [kernel] tests/syntax/built.i:21:
Case label -1 exceeds range of unsigned int for switch expression. Nothing to worry. Case label -1 exceeds range of unsigned int for switch expression. Nothing to worry.
/* Generated by Frama-C */ /* Generated by Frama-C */
__inline static __attribute__((__noreturn__)) int dummy_f__fc_inline(void); __inline static _Noreturn int dummy_f__fc_inline(void);
__inline static int dummy_f__fc_inline(void) __inline static int dummy_f__fc_inline(void)
{ {
int __retres; int __retres;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment