Skip to content

Commit 9422f41

Browse files
committed
Annotate noreturn on gpre functions
1 parent 95fcaf2 commit 9422f41

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/gpre/gpre.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ struct ext_table_t
193193
};
194194

195195

196-
static const ext_table_t dml_ext_table[] =
196+
static constexpr ext_table_t dml_ext_table[] =
197197
{
198198
{ lang_c, IN_SW_GPRE_C, ".e", ".c" },
199199

@@ -234,13 +234,13 @@ static const ext_table_t dml_ext_table[] =
234234
{ lang_undef, IN_SW_GPRE_0, NULL, NULL }
235235
};
236236

237-
const UCHAR CHR_LETTER = 1;
238-
const UCHAR CHR_DIGIT = 2;
239-
const UCHAR CHR_IDENT = 4;
240-
const UCHAR CHR_QUOTE = 8;
241-
const UCHAR CHR_WHITE = 16;
242-
const UCHAR CHR_INTRODUCER = 32;
243-
const UCHAR CHR_DBLQUOTE = 64;
237+
constexpr UCHAR CHR_LETTER = 1;
238+
constexpr UCHAR CHR_DIGIT = 2;
239+
constexpr UCHAR CHR_IDENT = 4;
240+
constexpr UCHAR CHR_QUOTE = 8;
241+
constexpr UCHAR CHR_WHITE = 16;
242+
constexpr UCHAR CHR_INTRODUCER = 32;
243+
constexpr UCHAR CHR_DBLQUOTE = 64;
244244

245245

246246
static void atexit_fb_shutdown()
@@ -891,7 +891,7 @@ int main(int argc, char* argv[])
891891
// Abort this silly program.
892892
//
893893

894-
void CPR_abort()
894+
[[noreturn]] void CPR_abort()
895895
{
896896
++fatals_global;
897897
//throw Firebird::Exception();
@@ -905,11 +905,11 @@ void CPR_abort()
905905
// Report an assertion failure and abort this silly program.
906906
//
907907

908-
void CPR_assert(const TEXT* file, int line)
908+
[[noreturn]] void CPR_assert(const TEXT* file, int line)
909909
{
910910
TEXT buffer[MAXPATHLEN << 1];
911911

912-
fb_utils::snprintf(buffer, sizeof(buffer),
912+
snprintf(buffer, sizeof(buffer),
913913
"GPRE assertion failure file '%s' line '%d'", file, line);
914914
CPR_bugcheck(buffer);
915915
}
@@ -921,7 +921,7 @@ void CPR_assert(const TEXT* file, int line)
921921
// Issue an error message.
922922
//
923923

924-
void CPR_bugcheck(const TEXT* string)
924+
[[noreturn]] void CPR_bugcheck(const TEXT* string)
925925
{
926926
fprintf(stderr, "*** INTERNAL BUGCHECK: %s ***\n", string);
927927
MET_fini(0);
@@ -959,7 +959,7 @@ int CPR_error(const TEXT* string)
959959
// Exit with status.
960960
//
961961

962-
void CPR_exit( int stat)
962+
[[noreturn]] void CPR_exit( int stat)
963963
{
964964
#ifdef LINUX
965965

@@ -1137,12 +1137,12 @@ void CPR_get_text( TEXT* buffer, const gpre_txt* text)
11371137
// Generate a syntax error.
11381138
//
11391139

1140-
void CPR_s_error(const TEXT* string)
1140+
[[noreturn]] void CPR_s_error(const TEXT* string)
11411141
{
11421142
TEXT s[512];
11431143

1144-
fb_utils::snprintf(s, sizeof(s),
1145-
"expected %s, encountered \"%s\"", string, gpreGlob.token_global.tok_string);
1144+
snprintf(s, sizeof(s),
1145+
"expected %s, encountered \"%s\"", string, gpreGlob.token_global.tok_string);
11461146
CPR_error(s);
11471147
PAR_unwind();
11481148
}

src/gpre/gpre_proto.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@
2626

2727
#include "../gpre/parse.h"
2828

29-
void CPR_abort();
29+
[[noreturn]] void CPR_abort();
3030
#ifdef DEV_BUILD
31-
void CPR_assert(const TEXT*, int);
31+
[[noreturn]] void CPR_assert(const TEXT*, int);
3232
#endif
33-
void CPR_bugcheck(const TEXT*);
33+
[[noreturn]] void CPR_bugcheck(const TEXT*);
3434
void CPR_end_text(gpre_txt*);
3535
int CPR_error(const TEXT*);
36-
void CPR_exit(int);
36+
[[noreturn]] void CPR_exit(int);
3737
void CPR_warn(const TEXT*);
3838
tok* CPR_eol_token();
3939
void CPR_get_text(TEXT*, const gpre_txt*);
40-
void CPR_s_error(const TEXT*);
40+
[[noreturn]] void CPR_s_error(const TEXT*);
4141
gpre_txt* CPR_start_text();
4242
tok* CPR_token();
4343

0 commit comments

Comments
 (0)