Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis compiler clang fix warnings #86

Merged
merged 9 commits into from Mar 21, 2015

Conversation

zmughal
Copy link
Member

@zmughal zmughal commented Mar 21, 2015

Combines #85 and #84.

zmughal and others added 9 commits March 18, 2015 18:45
This is in order to test against compilers other than GCC.

This fixes <#13>.
…PERL_MM_OPT

`PERL_MM_OPT` does not work with Makefile.PLs in subdirectories. Running

    perl Makefile.PL CC=clang; find -name Makefile -exec grep -H '^CC =' {} \;

shows that `CC = clang` in the toplevel Makefile, but `CC = cc`
elsewhere.
All of these came from one line in Basic/Gen/PP.pm that used an
assignment in a macro argument. But in the Perl macro cascade
there is #defined HvAUX(hv), which uses its argument twice.
This caused the assignment to happen twice. It was a harmless
unintended consequence, but at least the warnings have gone away.
It used to be that you could call printf(buf), but now for security
purposes it needs to be printf("%s",buf). Since Perl_croak just uses
printf (I think), I just added "%s" to a single line in Dev.pm.
This is a bit nanny-ish, just asking for an extra set of parenthesis
to make sure we understand the C operator precedence rules. We do.
This warning happens when you do an assignment in a conditional:
if (a=something()).  Compiler checks to make sure you didn't mean
if (a==something()). Get around that by adding an extra set of
parentheses around the assignment.
clang was complaining because the generated code turned out to
be somthing like 'PDL_short foo = 0.25;' which is a type mismatch.
0.25 got rounded to 0 before assignment to PDL_short foo.
This is actually what the cheesy test for floating-pointiness
intended, so I suppressed that warning in the Makefile.PL.

An alternative would be to have a type() look for integers and
one for floating-point datatypes.
It's been a few decades since void was introduced...
@coveralls
Copy link

Coverage Status

Coverage remained the same at 48.95% when pulling 358d0a7 on travis-compiler-clang-fix-warnings into aa7c613 on master.

@mohawk2
Copy link
Member

mohawk2 commented Mar 21, 2015

This looks fine (and nice Travis work, @zmughal) - this looks like it should be merged.

@mohawk2 mohawk2 merged commit 358d0a7 into master Mar 21, 2015
@mohawk2 mohawk2 mentioned this pull request Mar 21, 2015
@mohawk2 mohawk2 deleted the travis-compiler-clang-fix-warnings branch March 21, 2015 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants