From 7ad005b197b437d75e7378fa174f08f9cf043d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Fri, 27 Nov 2015 12:44:08 +0100 Subject: [PATCH] Add Add-missing-parentheses-to-SRL_ENC_HAVE_OPTION-argum patch --- ...ntheses-to-SRL_ENC_HAVE_OPTION-argum.patch | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Sereal-3.007-Add-missing-parentheses-to-SRL_ENC_HAVE_OPTION-argum.patch diff --git a/Sereal-3.007-Add-missing-parentheses-to-SRL_ENC_HAVE_OPTION-argum.patch b/Sereal-3.007-Add-missing-parentheses-to-SRL_ENC_HAVE_OPTION-argum.patch new file mode 100644 index 0000000..435adc3 --- /dev/null +++ b/Sereal-3.007-Add-missing-parentheses-to-SRL_ENC_HAVE_OPTION-argum.patch @@ -0,0 +1,41 @@ +From 38b829d8845fc795d9404cd0e24b21c5b06f0a6e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Fri, 27 Nov 2015 11:17:25 +0100 +Subject: [PATCH] Add missing parentheses to SRL_ENC_HAVE_OPTION arguments +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GCC warns about missing parentheses: + +In file included from srl_encoder.c:50:0: +srl_encoder.c: In function ‘srl_dump_hv’: +srl_encoder.h:141:58: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses] + #define SRL_ENC_HAVE_OPTION(enc, flag_num) ((enc)->flags & flag_num) + ^ +srl_encoder.c:1431:18: note: in expansion of macro ‘SRL_ENC_HAVE_OPTION’ + if ( SRL_ENC_HAVE_OPTION(enc, SRL_F_SORT_KEYS|SRL_F_SORT_KEYS_PERL) ) { + +And indeed this is a bug. + +Signed-off-by: Petr Písař +--- + Perl/Encoder/srl_encoder.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Perl/Encoder/srl_encoder.h b/Perl/Encoder/srl_encoder.h +index 12ca951..639f220 100644 +--- a/Perl/Encoder/srl_encoder.h ++++ b/Perl/Encoder/srl_encoder.h +@@ -140,7 +140,7 @@ SV *srl_dump_data_structure_mortal_sv(pTHX_ srl_encoder_t *enc, SV *src, SV *use + /* Set while the encoder is in active use / dirty */ + #define SRL_OF_ENCODER_DIRTY 1UL + +-#define SRL_ENC_HAVE_OPTION(enc, flag_num) ((enc)->flags & flag_num) ++#define SRL_ENC_HAVE_OPTION(enc, flag_num) ((enc)->flags & (flag_num)) + #define SRL_ENC_SET_OPTION(enc, flag_num) STMT_START {(enc)->flags |= (flag_num);}STMT_END + #define SRL_ENC_RESET_OPTION(enc, flag_num) STMT_START {(enc)->flags &= ~(flag_num);}STMT_END + +-- +2.4.3 +