samtools / bcftools

This is the official development repository for BCFtools. See installation instructions and other documentation here http://samtools.github.io/bcftools/howtos/install.html
http://samtools.github.io/bcftools/
Other
680 stars 240 forks source link

Work around an incompatibility between Perl and clang warnings. #2275

Closed jkbonfield closed 2 months ago

jkbonfield commented 2 months ago

A trivial issue, but with an equally trivial workaround.

Certain versions of perl trigger clang warnings about bracing:

In file included from filter.c:55:
...
/usr/lib/x86_64-linux-gnu/perl/5.34/CORE/zaphod32_hash.h:150:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
  150 |     ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/x86_64-linux-gnu/perl/5.34/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
   80 | #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \

The perl headers can optionally omit the use of "({ statement })" in macros, so we use this so we can do clang builds with --enable-perl-filters without excessive warnings (or errors if using -Werror).

Fixed in later perls. See also https://github.com/Perl/perl5/issues/18780

pd3 commented 2 months ago

Thank you