Opened 6 years ago

Closed 6 years ago

#829 closed defect (wontfix)

compiler warning: comma at end of enumerator list

Reported by: Peter Owned by: Jari Häkkinen
Priority: minor Milestone:
Component: build Version: trunk
Keywords: Cc:

Description

I get the following compiler warning when compiling with -pedantic:

In file included from /home/peterJo/local/htslib/include/htslib/sam.h:30,
                 from ../yat/omic/BamHeader.h:27,
                 from ../yat/omic/BamFile.h:25,
                 from ../yat/omic/BamFile.cc:24:
/home/peterJo/local/htslib/include/htslib/hts.h:140: warning: comma at end of enumerator list
/home/peterJo/local/htslib/include/htslib/hts.h:162: warning: comma at end of enumerator list

It's caused by header file hts.h and that it has a stray comma in the enum declarations. It's valid code in C99 and C++11 but not in C89 or C++98. The warning is only triggered in -pedantic.

Is there a way to turn off the rule a la -Wno-long-long? With Autoconf 2.70 configure will choose C++11 if available, and the problem will fade away.

Change History (2)

comment:1 Changed 6 years ago by Peter

I got this reply from John Marshall via samtools-devel list:

We could remove such commas, though there are small editing and source control reasons for having them and they are explicitly valid in C99 and C++11 and are common extensions previously.

And in fact they are accepted as an extension in your GCC 4.4.7. To get this warning I guess you are compiling with -pedantic, in which case aren't you getting several other annoying warnings from hts.h too?

Anyway, GCC (including 4.4.7) emits this warning only outside system headers when -pedantic is on. So as a workaround, you could compile without -pedantic or use -isystem path/to/htslib instead of -I path/to/htslib. Or if you install htslib in a standard place, you won't need -I/-isystem at all and this warning should disappear even with -pedantic.

comment:2 Changed 6 years ago by Peter

Milestone: yat 0.x+
Resolution: wontfix
Status: newclosed

So in short, the issue goes away if I replace

./configure CPPFLAGS=-I/home/peterJo/local/htslib/include

with

./configure CPPFLAGS=-isystem /home/peterJo/local/htslib/include

Nothing to be done in yat.

Note: See TracTickets for help on using tickets.