From 97cf0ff62049482b1a82668f857a8a64819f3827 Mon Sep 17 00:00:00 2001 From: James Buren Date: Thu, 31 Oct 2024 17:19:34 -0500 Subject: [PATCH] [C] Add support for C11 noreturn compiler hint --- 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 fb969d4b54..2b75a60ea9 100644 --- a/C++/C.sublime-syntax +++ b/C++/C.sublime-syntax @@ -46,7 +46,7 @@ variables: declspec: '__declspec\(\s*\w+(?:\([^)]+\))?\s*\)' storage_classes: 'static|extern|register|thread_local|_Thread_local|constexpr|{{declspec}}' type_qualifier: 'const|volatile' - 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|sizeof|alignof|_Alignof|static_assert|_Static_assert|__declspec|__attribute__' diff --git a/C++/syntax_test_c.c b/C++/syntax_test_c.c index 8d3fc0e247..b529651466 100644 --- a/C++/syntax_test_c.c +++ b/C++/syntax_test_c.c @@ -319,6 +319,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 */