argtable/argtable3

`-Wpedantic` should be used conditonally on GCC version

barracuda156 opened this issue · 7 comments

The build fails with gcc-4.2 due to this flag:

cc1: error: unrecognized command line option "-Wpedantic"

Once removed, it succeeds.

I.e., it should be added conditionally, not for all GCC.

P. S. There is no reason not to support older gcc, all tests pass with it:

--->  Testing argtable3
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_argtable3/argtable3/work/build" && /usr/bin/make test 
Running tests...
/opt/local/bin/ctest --force-new-ctest-process 
Test project /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_argtable3/argtable3/work/build
    Start 1: test_shared
1/3 Test #1: test_shared ......................   Passed   32.89 sec
    Start 2: test_src
2/3 Test #2: test_src .........................   Passed   33.82 sec
    Start 3: test_amalgamation
3/3 Test #3: test_amalgamation ................   Passed   35.98 sec

100% tests passed, 0 tests failed out of 3

Total Test time (real) = 102.70 sec

One way to prevent this problem is using the amalgamation version of this library: just include argtable3.c and argtable.h in your project.

Thank you for responding. We have fixed it locally in Macports by conditionally (on compiler version) removing the breaking flag. It may still be beneficial to fix it in the master, IMO, since there may be people who try using it without Macports.

@barracuda156 : may I know how you fixed it in CMake?

@tomghuang We just used a conditional patch to remove the flag from CMakeLists, however it can be implemented in CMake with something like:

if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.2)

(I can make a PR if that makes it simpler.)

@barracuda156 : yes, the CMake code snippet that you proposed is a better solution. Please submit a PR for this improvement. Thanks.

Perhaps like this: #89