summaryrefslogtreecommitdiff
path: root/3rdparty
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty')
-rw-r--r--3rdparty/libconfig/extra/gen/Makefile1
-rw-r--r--3rdparty/libconfig/extra/gen/Makefile.in1
-rw-r--r--3rdparty/libconfig/extra/gen/clangwarnings.patch36
-rw-r--r--3rdparty/libconfig/extra/gen/scanner.l12
-rw-r--r--3rdparty/libconfig/grammar.c4
-rw-r--r--3rdparty/libconfig/scanctx.c2
-rw-r--r--3rdparty/libconfig/scanner.c117
-rw-r--r--3rdparty/libconfig/scanner.h2
8 files changed, 112 insertions, 63 deletions
diff --git a/3rdparty/libconfig/extra/gen/Makefile b/3rdparty/libconfig/extra/gen/Makefile
index b4d2db841..0b2e0655e 100644
--- a/3rdparty/libconfig/extra/gen/Makefile
+++ b/3rdparty/libconfig/extra/gen/Makefile
@@ -31,6 +31,7 @@ AM_YFLAGS = -d -p $(PARSER_PREFIX)
AM_LFLAGS = --nounistd --header-file=scanner.h --prefix=$(PARSER_PREFIX)
all: $(BUILT_SOURCES)
+ @patch -p1 < clangwarnings.patch
.SUFFIXES: .c .l .y
diff --git a/3rdparty/libconfig/extra/gen/Makefile.in b/3rdparty/libconfig/extra/gen/Makefile.in
index 5850c2392..0bd4efd62 100644
--- a/3rdparty/libconfig/extra/gen/Makefile.in
+++ b/3rdparty/libconfig/extra/gen/Makefile.in
@@ -31,6 +31,7 @@ AM_YFLAGS = -d -p $(PARSER_PREFIX)
AM_LFLAGS = --nounistd --header-file=scanner.h --prefix=$(PARSER_PREFIX)
all: $(BUILT_SOURCES)
+ @patch -p1 < clangwarnings.patch
.SUFFIXES: .c .l .y
diff --git a/3rdparty/libconfig/extra/gen/clangwarnings.patch b/3rdparty/libconfig/extra/gen/clangwarnings.patch
new file mode 100644
index 000000000..65aef9a08
--- /dev/null
+++ b/3rdparty/libconfig/extra/gen/clangwarnings.patch
@@ -0,0 +1,36 @@
+diff --git a/grammar.c b/grammar.c
+index 3595578..26444f8 100644
+--- a/grammar.c
++++ b/grammar.c
+@@ -1187,9 +1187,7 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx,
+ YYUSE (ctx);
+ YYUSE (scan_ctx);
+
+- if (!yymsg)
+- yymsg = "Deleting";
+- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
++ YY_SYMBOL_PRINT (yymsg ? yymsg : "Deleting", yytype, yyvaluep, yylocationp);
+
+ switch (yytype)
+ {
+diff --git a/scanner.c b/scanner.c
+index aebd34c..c3a717f 100644
+--- a/scanner.c
++++ b/scanner.c
+@@ -1500,6 +1500,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
++#ifndef __clang_analyzer__
++ // FIXME: Clang's static analyzer complains about leaking the result of libconfig_yyrealloc
+ if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+@@ -1507,6 +1509,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
++#endif // __clang_analyzer__
+
+ yyg->yy_n_chars += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
diff --git a/3rdparty/libconfig/extra/gen/scanner.l b/3rdparty/libconfig/extra/gen/scanner.l
index 4b3048fab..66364e019 100644
--- a/3rdparty/libconfig/extra/gen/scanner.l
+++ b/3rdparty/libconfig/extra/gen/scanner.l
@@ -86,6 +86,13 @@ static unsigned long long fromhex(const char *s)
#endif /* __MINGW32__ */
}
+static int fromihex(const char *s) {
+ unsigned long l = strtoul(s, NULL, 16);
+ if (l > INT32_MAX)
+ l = INT32_MAX;
+ return (int)l;
+}
+
%}
true [Tt][Rr][Uu][Ee]
@@ -178,10 +185,7 @@ include_open ^[ \t]*@include[ \t]+\"
{float} { yylval->fval = atof(yytext); return(TOK_FLOAT); }
{integer} { yylval->ival = atoi(yytext); return(TOK_INTEGER); }
{integer64} { yylval->llval = atoll(yytext); return(TOK_INTEGER64); }
-{hex} {
- yylval->ival = strtoul(yytext, NULL, 16);
- return(TOK_HEX);
- }
+{hex} { yylval->ival = fromihex(yytext); return(TOK_HEX); }
{hex64} { yylval->llval = fromhex(yytext); return(TOK_HEX64); }
\[ { return(TOK_ARRAY_START); }
\] { return(TOK_ARRAY_END); }
diff --git a/3rdparty/libconfig/grammar.c b/3rdparty/libconfig/grammar.c
index 3595578de..26444f816 100644
--- a/3rdparty/libconfig/grammar.c
+++ b/3rdparty/libconfig/grammar.c
@@ -1187,9 +1187,7 @@ yydestruct (yymsg, yytype, yyvaluep, scanner, ctx, scan_ctx)
YYUSE (ctx);
YYUSE (scan_ctx);
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+ YY_SYMBOL_PRINT (yymsg ? yymsg : "Deleting", yytype, yyvaluep, yylocationp);
switch (yytype)
{
diff --git a/3rdparty/libconfig/scanctx.c b/3rdparty/libconfig/scanctx.c
index 7d7f4994c..e057d50bc 100644
--- a/3rdparty/libconfig/scanctx.c
+++ b/3rdparty/libconfig/scanctx.c
@@ -39,6 +39,7 @@ static const char *err_include_too_deep = "include file nesting too deep";
static const char *__scanctx_add_filename(struct scan_context *ctx,
const char *filename)
{
+#ifndef __clang_analyzer__ // FIXME: Clang's static analyzer doesn't like this
unsigned int count = ctx->num_filenames;
const char **f;
@@ -60,6 +61,7 @@ static const char *__scanctx_add_filename(struct scan_context *ctx,
ctx->filenames[ctx->num_filenames] = filename;
++ctx->num_filenames;
+#endif // __clang_analyzer__
return(filename);
}
diff --git a/3rdparty/libconfig/scanner.c b/3rdparty/libconfig/scanner.c
index 6de72c2fd..c3a717ff0 100644
--- a/3rdparty/libconfig/scanner.c
+++ b/3rdparty/libconfig/scanner.c
@@ -625,8 +625,15 @@ static unsigned long long fromhex(const char *s)
#endif /* __MINGW32__ */
}
+static int fromihex(const char *s) {
+ unsigned long l = strtoul(s, NULL, 16);
+ if (l > INT32_MAX)
+ l = INT32_MAX;
+ return (int)l;
+}
+
-#line 630 "scanner.c"
+#line 637 "scanner.c"
#define INITIAL 0
#define COMMENT 1
@@ -858,10 +865,10 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 105 "scanner.l"
+#line 112 "scanner.l"
-#line 865 "scanner.c"
+#line 872 "scanner.c"
yylval = yylval_param;
@@ -957,69 +964,69 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 107 "scanner.l"
+#line 114 "scanner.l"
{ BEGIN COMMENT; }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 108 "scanner.l"
+#line 115 "scanner.l"
{ BEGIN INITIAL; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 109 "scanner.l"
+#line 116 "scanner.l"
{ /* ignore */ }
YY_BREAK
case 4:
/* rule 4 can match eol */
YY_RULE_SETUP
-#line 110 "scanner.l"
+#line 117 "scanner.l"
{ /* ignore */ }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 112 "scanner.l"
+#line 119 "scanner.l"
{ BEGIN STRING; }
YY_BREAK
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
-#line 113 "scanner.l"
+#line 120 "scanner.l"
{ scanctx_append_string(yyextra, yytext); }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 114 "scanner.l"
+#line 121 "scanner.l"
{ scanctx_append_string(yyextra, "\n"); }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 115 "scanner.l"
+#line 122 "scanner.l"
{ scanctx_append_string(yyextra, "\r"); }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 116 "scanner.l"
+#line 123 "scanner.l"
{ scanctx_append_string(yyextra, "\t"); }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 117 "scanner.l"
+#line 124 "scanner.l"
{ scanctx_append_string(yyextra, "\f"); }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 118 "scanner.l"
+#line 125 "scanner.l"
{ scanctx_append_string(yyextra, "\\"); }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 119 "scanner.l"
+#line 126 "scanner.l"
{ scanctx_append_string(yyextra, "\""); }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 120 "scanner.l"
+#line 127 "scanner.l"
{
char c[2] = { (char)(strtol(yytext + 2, NULL, 16) & 0xFF),
0 };
@@ -1028,12 +1035,12 @@ YY_RULE_SETUP
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 125 "scanner.l"
+#line 132 "scanner.l"
{ scanctx_append_string(yyextra, "\\"); }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 126 "scanner.l"
+#line 133 "scanner.l"
{
yylval->sval = scanctx_take_string(yyextra);
BEGIN INITIAL;
@@ -1042,18 +1049,18 @@ YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 132 "scanner.l"
+#line 139 "scanner.l"
{ BEGIN SCRIPTBLOCK; }
YY_BREAK
case 17:
/* rule 17 can match eol */
YY_RULE_SETUP
-#line 133 "scanner.l"
+#line 140 "scanner.l"
{ scanctx_append_string(yyextra, yytext); }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 134 "scanner.l"
+#line 141 "scanner.l"
{
yylval->sval = scanctx_take_string(yyextra);
BEGIN INITIAL;
@@ -1062,28 +1069,28 @@ YY_RULE_SETUP
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 140 "scanner.l"
+#line 147 "scanner.l"
{ BEGIN INCLUDE; }
YY_BREAK
case 20:
/* rule 20 can match eol */
YY_RULE_SETUP
-#line 141 "scanner.l"
+#line 148 "scanner.l"
{ scanctx_append_string(yyextra, yytext); }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 142 "scanner.l"
+#line 149 "scanner.l"
{ scanctx_append_string(yyextra, "\\"); }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 143 "scanner.l"
+#line 150 "scanner.l"
{ scanctx_append_string(yyextra, "\""); }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 144 "scanner.l"
+#line 151 "scanner.l"
{
const char *error;
FILE *fp = scanctx_push_include(yyextra,
@@ -1109,100 +1116,97 @@ YY_RULE_SETUP
case 24:
/* rule 24 can match eol */
YY_RULE_SETUP
-#line 168 "scanner.l"
+#line 175 "scanner.l"
{ /* ignore */ }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 169 "scanner.l"
+#line 176 "scanner.l"
{ /* ignore */ }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 171 "scanner.l"
+#line 178 "scanner.l"
{ return(TOK_EQUALS); }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 172 "scanner.l"
+#line 179 "scanner.l"
{ return(TOK_COMMA); }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 173 "scanner.l"
+#line 180 "scanner.l"
{ return(TOK_GROUP_START); }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 174 "scanner.l"
+#line 181 "scanner.l"
{ return(TOK_GROUP_END); }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 175 "scanner.l"
+#line 182 "scanner.l"
{ yylval->ival = 1; return(TOK_BOOLEAN); }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 176 "scanner.l"
+#line 183 "scanner.l"
{ yylval->ival = 0; return(TOK_BOOLEAN); }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 177 "scanner.l"
+#line 184 "scanner.l"
{ yylval->sval = yytext; return(TOK_NAME); }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 178 "scanner.l"
+#line 185 "scanner.l"
{ yylval->fval = atof(yytext); return(TOK_FLOAT); }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 179 "scanner.l"
+#line 186 "scanner.l"
{ yylval->ival = atoi(yytext); return(TOK_INTEGER); }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 180 "scanner.l"
+#line 187 "scanner.l"
{ yylval->llval = atoll(yytext); return(TOK_INTEGER64); }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 181 "scanner.l"
-{
- yylval->ival = strtoul(yytext, NULL, 16);
- return(TOK_HEX);
- }
+#line 188 "scanner.l"
+{ yylval->ival = fromihex(yytext); return(TOK_HEX); }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 185 "scanner.l"
+#line 189 "scanner.l"
{ yylval->llval = fromhex(yytext); return(TOK_HEX64); }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 186 "scanner.l"
+#line 190 "scanner.l"
{ return(TOK_ARRAY_START); }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 187 "scanner.l"
+#line 191 "scanner.l"
{ return(TOK_ARRAY_END); }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 188 "scanner.l"
+#line 192 "scanner.l"
{ return(TOK_LIST_START); }
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 189 "scanner.l"
+#line 193 "scanner.l"
{ return(TOK_LIST_END); }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 190 "scanner.l"
+#line 194 "scanner.l"
{ return(TOK_SEMICOLON); }
YY_BREAK
case 43:
@@ -1210,12 +1214,12 @@ case 43:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 191 "scanner.l"
+#line 195 "scanner.l"
{ /* ignore */ }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 192 "scanner.l"
+#line 196 "scanner.l"
{ return(TOK_GARBAGE); }
YY_BREAK
case YY_STATE_EOF(INITIAL):
@@ -1223,7 +1227,7 @@ case YY_STATE_EOF(COMMENT):
case YY_STATE_EOF(STRING):
case YY_STATE_EOF(INCLUDE):
case YY_STATE_EOF(SCRIPTBLOCK):
-#line 194 "scanner.l"
+#line 198 "scanner.l"
{
YY_BUFFER_STATE buf = (YY_BUFFER_STATE)scanctx_pop_include(
yyextra);
@@ -1238,10 +1242,10 @@ case YY_STATE_EOF(SCRIPTBLOCK):
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 205 "scanner.l"
+#line 209 "scanner.l"
ECHO;
YY_BREAK
-#line 1245 "scanner.c"
+#line 1249 "scanner.c"
case YY_END_OF_BUFFER:
{
@@ -1496,6 +1500,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
+#ifndef __clang_analyzer__
+ // FIXME: Clang's static analyzer complains about leaking the result of libconfig_yyrealloc
if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
@@ -1503,6 +1509,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
}
+#endif // __clang_analyzer__
yyg->yy_n_chars += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
@@ -2375,4 +2382,4 @@ void libconfig_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 205 "scanner.l"
+#line 209 "scanner.l"
diff --git a/3rdparty/libconfig/scanner.h b/3rdparty/libconfig/scanner.h
index 181bc5c94..ac79ff5d1 100644
--- a/3rdparty/libconfig/scanner.h
+++ b/3rdparty/libconfig/scanner.h
@@ -334,7 +334,7 @@ extern int libconfig_yylex \
#undef YY_DECL
#endif
-#line 205 "scanner.l"
+#line 209 "scanner.l"
#line 340 "scanner.h"
#undef libconfig_yyIN_HEADER