Add well-considered patches for all compiler warnings

i9ce
Benjamin A. Beasley 4 years ago
parent 8e85a8c3c4
commit b13e16caa7

@ -0,0 +1,36 @@
diff -Naur libIDL-0.8.14-original/lexer.l libIDL-0.8.14/lexer.l
--- libIDL-0.8.14-original/lexer.l 2009-04-18 08:20:37.000000000 -0400
+++ libIDL-0.8.14/lexer.l 2021-02-03 12:56:01.237822569 -0500
@@ -269,17 +269,29 @@
<*>{whitespace} ;
{b8_int} {
yylval.integer = 0;
- sscanf (yytext, "%" IDL_LL "o", &yylval.integer);
+ {
+ long long unsigned yyltmp = 0;
+ sscanf (yytext, "%" IDL_LL "o", &yyltmp);
+ memmove (&yylval.integer, &yyltmp, sizeof (yylval.integer));
+ }
tokreturn (TOK_INTEGER);
}
{b10_uint} {
yylval.integer = 0;
- sscanf (yytext, "%" IDL_LL "u", &yylval.integer);
+ {
+ long long unsigned yyltmp = 0;
+ sscanf (yytext, "%" IDL_LL "u", &yyltmp);
+ memmove (&yylval.integer, &yyltmp, sizeof (yylval.integer));
+ }
tokreturn (TOK_INTEGER);
}
{b16_int} {
yylval.integer = 0;
- sscanf (yytext + 2, "%" IDL_LL "x", &yylval.integer);
+ {
+ long long unsigned yyltmp = 0;
+ sscanf (yytext + 2, "%" IDL_LL "x", &yyltmp);
+ memmove (&yylval.integer, &yyltmp, sizeof (yylval.integer));
+ }
tokreturn (TOK_INTEGER);
}
{fixed_lit} {

@ -17,3 +17,15 @@ diff -Naur libIDL-0.8.14-original/parser.y libIDL-0.8.14/parser.y
if (ident) if (ident)
IDL_tree_warning (ident, IDL_tree_warning (ident,
IDL_WARNING1, "From constant declared here"); IDL_WARNING1, "From constant declared here");
diff -Naur libIDL-0.8.14-original/util.c libIDL-0.8.14/util.c
--- libIDL-0.8.14-original/util.c 2009-04-18 08:20:37.000000000 -0400
+++ libIDL-0.8.14/util.c 2021-02-03 12:42:13.641470825 -0500
@@ -2818,7 +2818,7 @@
case IDLN_INTEGER:
/* FIXME: sign */
- dataf (data, "%" IDL_LL "d", IDL_INTEGER (p).value);
+ dataf (data, "%" IDL_LL "d", (long long) IDL_INTEGER (p).value);
break;
case IDLN_FIXED:

@ -0,0 +1,16 @@
diff -Naur libIDL-0.8.14-original/parser.y libIDL-0.8.14/parser.y
--- libIDL-0.8.14-original/parser.y 2009-04-18 08:20:37.000000000 -0400
+++ libIDL-0.8.14/parser.y 2021-02-03 12:44:47.638466666 -0500
@@ -898,11 +898,9 @@
;
primary_expr: scoped_name {
- IDL_tree p, literal;
+ IDL_tree literal;
assert (IDL_NODE_TYPE ($1) == IDLN_IDENT);
-
- p = IDL_NODE_UP ($1);
if ((literal = IDL_resolve_const_exp ($1, IDLN_ANY))) {
++IDL_NODE_REFS (literal);

@ -16,13 +16,21 @@ License: LGPLv2+
# Fix paths reported by the libIDL-config-2 tool to conform with Fedora # Fix paths reported by the libIDL-config-2 tool to conform with Fedora
# multilib installation paths: # multilib installation paths:
Patch0: %{name}-0.8.6-multilib.patch Patch0: %{name}-0.8.6-multilib.patch
# Remove an unused parent-node variable in the primary_expr part of the parser,
# which caused a compiler warning.
Patch1: %{name}-0.8.14-parser-primary_expr-unused-parent-node.patch
# On platforms (such as 64-bit Linux), where long long int and long int are # On platforms (such as 64-bit Linux), where long long int and long int are
# both 64-bit, we can have IDL_LL defined to ll (format with %%lld) while # both 64-bit, we can have IDL_LL defined to ll (format with %%lld) while
# IDL_longlong_t, which is just gint64, may be ultimately defined to long int. # IDL_longlong_t, which is just gint64, may be ultimately defined to long int.
# This results in compiler warnings about the mismatch between the long long # This results in compiler warnings about the mismatch between the long long
# format and long parameter, even though the types are compatible. We can fix # format and long parameter, even though the types are compatible. We can fix
# this with a cast to (long long) before formatting. # this with a cast to (long long) before formatting.
Patch1: %{name}-0.8.14-long-long-format-warnings.patch Patch2: %{name}-0.8.14-long-long-format-warnings.patch
# Instead of type-punning with sscanf, parse into a temporary with a type
# matching the format code and then memmove into the “integer” storage. This is
# no less platform-dependent, but does not invoke undefined behavior or produce
# a compiler warning.
Patch3: %{name}-0.8.14-lexer-sscanf-type-punning.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: make BuildRequires: make
@ -98,7 +106,7 @@ rm '%{buildroot}%{_libdir}/%{name}-2.la'
- Drop obsolete %%ldconfig_scriptlets macro - Drop obsolete %%ldconfig_scriptlets macro
- Use much stricter path globs - Use much stricter path globs
- Use %%name macro - Use %%name macro
- Patch long long format warnings - Add well-considered patches for all compiler warnings
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.14-23 * Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.14-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

Loading…
Cancel
Save