mauke / Function-Parameters

Function::Parameters - define functions and methods with parameter lists ("subroutine signatures")
https://metacpan.org/pod/Function::Parameters
18 stars 19 forks source link

Doesn't work with clang #7

Closed schwern closed 9 years ago

schwern commented 9 years ago

01b110157fbc0088f5127144ccd595c011afc9cd introduced some compiler options which do not work with clang (the default OS X compiler).

$ perl Makefile.PL 
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Function::Parameters
Writing MYMETA.yml and MYMETA.json
Windhund:Function-Parameters schwern$ make
cp lib/Function/Parameters/Info.pm blib/lib/Function/Parameters/Info.pm
cp lib/Function/Parameters.pm blib/lib/Function/Parameters.pm
Running Mkbootstrap for Function::Parameters ()
chmod 644 "Parameters.bs"
"/Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/bin/perl" "/Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/lib/site_perl/5.18.1/ExtUtils/xsubpp"  -typemap "/Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/lib/5.18.1/ExtUtils/typemap"  Parameters.xs > Parameters.xsc && mv Parameters.xsc Parameters.c
cc -c   -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/opt/local/include -DDEVEL -fsanitize=address -fsanitize=undefined -O3   -DVERSION=\"1.0603_02\" -DXS_VERSION=\"1.0603_02\"  "-I/Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/lib/5.18.1/darwin-thread-multi-2level/CORE"   Parameters.c
clang: error: unsupported argument 'undefined' to option 'fsanitize='
clang: error: unsupported argument 'address' to option 'fsanitize='
make: *** [Parameters.o] Error 1
mauke commented 9 years ago

Those options are set in GNUmakefile, which is not part of the CPAN distribution (so this shouldn't affect "normal" users). I use it to turn on options for development. So far I've only used gcc, so clang development compatibility is not a priority.

But according to http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation those flags should be supported. Is this a version issue?

schwern commented 9 years ago

This is what OS X 10.10.2 is using.

$ clang --version
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

The odd thing is it's in the --help.

$ clang --help | grep -- -fsan
  -fsanitize-blacklist=<value>
  -fsanitize-memory-track-origins
  -fsanitize=<check>      Enable runtime instrumentation for bug detection: undefined (miscellaneous undefined behavior)

But it doesn't work on the command line.

$ clang -fsanitize=address ~/tmp/test.c 
clang: error: unsupported argument 'address' to option 'fsanitize='
$ clang -fsanitize=undefined ~/tmp/test.c 
clang: error: unsupported argument 'undefined' to option 'fsanitize='
mauke commented 9 years ago

Googling the error message shows that this is Apple specific. Apparently it works if you build clang from source.

Workaround for this repo: make -f Makefile, so I'm just going to close this.