From 8e6cb7eae7e68e127c6e7e2d641f0454979c8d82 Mon Sep 17 00:00:00 2001 From: braewoods Date: Thu, 7 Nov 2024 09:18:45 -0600 Subject: [PATCH] [C] Add support for C11 noreturn compiler hint (#4083) --- C++/C.sublime-syntax | 2 +- C++/syntax_test_c.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/C++/C.sublime-syntax b/C++/C.sublime-syntax index 4d8ef4e3d8..20239f5e07 100644 --- a/C++/C.sublime-syntax +++ b/C++/C.sublime-syntax @@ -49,7 +49,7 @@ variables: declspec: '__declspec\(\s*\w+(?:\([^)]+\))?\s*\)' storage_classes: 'static|extern|register|thread_local|_Thread_local|constexpr|{{declspec}}' type_qualifier: 'const|volatile|_Atomic' - compiler_directive: 'inline|restrict|__restrict__|__restrict' + compiler_directive: 'inline|restrict|__restrict__|__restrict|_Noreturn|noreturn' modifiers: '{{storage_classes}}|{{type_qualifier}}|{{compiler_directive}}' non_func_keywords: 'if|for|switch|while|decltype|typeof|typeof_unqual|_Atomic|sizeof|alignof|_Alignof|static_assert|_Static_assert|__declspec|__attribute__' diff --git a/C++/syntax_test_c.c b/C++/syntax_test_c.c index a584de5c95..37b352f14e 100644 --- a/C++/syntax_test_c.c +++ b/C++/syntax_test_c.c @@ -361,6 +361,14 @@ void *null_pointer1 = NULL; void *null_pointer2 = nullptr; /* ^ constant.language.null */ +_Noreturn +/* <- storage.modifier */ +void foo(void) { abort(); } + +noreturn +/* <- storage.modifier */ +void bar(void) { abort(); } + FOOBAR hello() { /* <- meta.function entity.name.function */