Unnecessary compilation warnings enabled


#1

Hey folks,

Not sure if there is a configure flag to control this issue, but IMHO,
HDF5 has a 'bad' habit of turning on a bunch of compilation warnings --
those that I think only an HDF5 developer is really going to be able to
do anything about -- when I a lowly user am compiling it for production
or debug...

-std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-
function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -
Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-
declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long
-Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -
Wdisabled-optimization -O -fomit-frame-pointer -finline-functions

The problem is, some of these flags may not be compatible with options I
turn on in CFLAGS...

gcc: -pg and -fomit-frame-pointer are incompatible

So, I am thinking that all these darn warning options should be turned
OFF by default and only ON when an HDF5 developer or someone else who is
interested in (and can actually do something about them) these warnings
is compiling the code. Anyone else have a similar opinion? (I only want
to hear from people that agree with me :wink:

Mark

···

--
Mark C. Miller, Lawrence Livermore National Laboratory
email: mailto:miller86@llnl.gov
(M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
(Th/F) (530)-753-8511 (!!LLNL BUSINESS ONLY!!)


#2

Hi Mark,

I know you do not want to hear from me :slight_smile:

Timing of your email was very good. Just today we discussed the issue and decided to shelve it until someone complains. We need to better understand users' requirements before diving into pretty tedious revamping of the compilation flags.

One simple option will be to edit the config/gnu-flags file in the main distribution (or similar files for different compilers). Of course, one has to know what to do, therefore we need to provide a better documentations (it is in works).

Bottom line: We encourage everyone who agree with you to speak up to help us with the requirements, so we can come up with more user friendly solution than obscure file editing :-).

Thank you!

Elena

···

On Dec 1, 2009, at 12:18 PM, Mark Miller wrote:

Hey folks,

Not sure if there is a configure flag to control this issue, but IMHO,
HDF5 has a 'bad' habit of turning on a bunch of compilation warnings --
those that I think only an HDF5 developer is really going to be able to
do anything about -- when I a lowly user am compiling it for production
or debug...

-std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-
function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -
Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-
declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long
-Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -
Wdisabled-optimization -O -fomit-frame-pointer -finline-functions

The problem is, some of these flags may not be compatible with options I
turn on in CFLAGS...

gcc: -pg and -fomit-frame-pointer are incompatible

So, I am thinking that all these darn warning options should be turned
OFF by default and only ON when an HDF5 developer or someone else who is
interested in (and can actually do something about them) these warnings
is compiling the code. Anyone else have a similar opinion? (I only want
to hear from people that agree with me :wink:

Mark

--
Mark C. Miller, Lawrence Livermore National Laboratory
email: mailto:miller86@llnl.gov
(M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
(Th/F) (530)-753-8511 (!!LLNL BUSINESS ONLY!!)

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org


#3

In our cmake build version we've added a HDF5_DISABLE_BUILD_WARNINGS option which shuts it up quite nicely :slight_smile:

It may never make it beyond our current cmake tests ... but if it ever becomes part of the official release.

$0.02

JB

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Elena Pourmal
Sent: 01 December 2009 20:29
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] unnecessary compilation warnings enabled

Hi Mark,

I know you do not want to hear from me :slight_smile:

Timing of your email was very good. Just today we discussed the issue and
decided to shelve it until someone complains. We need to better understand
users' requirements before diving into pretty tedious revamping of the
compilation flags.

One simple option will be to edit the config/gnu-flags file in the main
distribution (or similar files for different compilers). Of course, one has
to know what to do, therefore we need to provide a better documentations (it
is in works).

Bottom line: We encourage everyone who agree with you to speak up to help us
with the requirements, so we can come up with more user friendly solution
than obscure file editing :-).

Thank you!

Elena

On Dec 1, 2009, at 12:18 PM, Mark Miller wrote:

> Hey folks,
>
> Not sure if there is a configure flag to control this issue, but IMHO,
> HDF5 has a 'bad' habit of turning on a bunch of compilation warnings --
> those that I think only an HDF5 developer is really going to be able to
> do anything about -- when I a lowly user am compiling it for production
> or debug...
>
> -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-
> function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -
> Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-
> declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long
> -Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -
> Wdisabled-optimization -O -fomit-frame-pointer -finline-functions
>
> The problem is, some of these flags may not be compatible with options I
> turn on in CFLAGS...
>
> gcc: -pg and -fomit-frame-pointer are incompatible
>
> So, I am thinking that all these darn warning options should be turned
> OFF by default and only ON when an HDF5 developer or someone else who is
> interested in (and can actually do something about them) these warnings
> is compiling the code. Anyone else have a similar opinion? (I only want
> to hear from people that agree with me :wink:
>
> Mark
>
>
> --
> Mark C. Miller, Lawrence Livermore National Laboratory
> email: mailto:miller86@llnl.gov
> (M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
> (Th/F) (530)-753-8511 (!!LLNL BUSINESS ONLY!!)
>
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> Hdf-forum@hdfgroup.org
> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org


#4

I did not think to respond to this earlier but I now have a
comment/question.

It seems as though the strategy here for HDF5 is to enable a slew of
warnings by default and only turn them off if configured to do so.

I certainly understand the value to HDF5 DEVELOPERS in having warnings,
etc. turned on. However, I am not sure I see the value in them for USERS
(e.g. those people who compile HDF5 for their use in some application
(s)). Can maybe someone explain what the value is for USERS?

I'd think the strategy would be to have them OFF by default and only ON
when requested during configure. That places the onus on DEVELOPERS to
turn them on when they need them and gives USERS greater likelihood they
won't introduce combinations of flags in CFLAGS that are NOT compatibile
with flags in H5_CFLAGS.

Mark

···

On Tue, 2009-12-01 at 20:50 +0100, Biddiscombe, John A. wrote:

In our cmake build version we've added a HDF5_DISABLE_BUILD_WARNINGS option which shuts it up quite nicely :slight_smile:

It may never make it beyond our current cmake tests ... but if it ever becomes part of the official release.

$0.02

JB

> -----Original Message-----
> From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
> On Behalf Of Elena Pourmal
> Sent: 01 December 2009 20:29
> To: hdf-forum@hdfgroup.org
> Subject: Re: [Hdf-forum] unnecessary compilation warnings enabled
>
> Hi Mark,
>
> I know you do not want to hear from me :slight_smile:
>
> Timing of your email was very good. Just today we discussed the issue and
> decided to shelve it until someone complains. We need to better understand
> users' requirements before diving into pretty tedious revamping of the
> compilation flags.
>
> One simple option will be to edit the config/gnu-flags file in the main
> distribution (or similar files for different compilers). Of course, one has
> to know what to do, therefore we need to provide a better documentations (it
> is in works).
>
> Bottom line: We encourage everyone who agree with you to speak up to help us
> with the requirements, so we can come up with more user friendly solution
> than obscure file editing :-).
>
> Thank you!
>
> Elena
>
>
>
> On Dec 1, 2009, at 12:18 PM, Mark Miller wrote:
>
> > Hey folks,
> >
> > Not sure if there is a configure flag to control this issue, but IMHO,
> > HDF5 has a 'bad' habit of turning on a bunch of compilation warnings --
> > those that I think only an HDF5 developer is really going to be able to
> > do anything about -- when I a lowly user am compiling it for production
> > or debug...
> >
> > -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-
> > function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -
> > Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-
> > declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long
> > -Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -
> > Wdisabled-optimization -O -fomit-frame-pointer -finline-functions
> >
> > The problem is, some of these flags may not be compatible with options I
> > turn on in CFLAGS...
> >
> > gcc: -pg and -fomit-frame-pointer are incompatible
> >
> > So, I am thinking that all these darn warning options should be turned
> > OFF by default and only ON when an HDF5 developer or someone else who is
> > interested in (and can actually do something about them) these warnings
> > is compiling the code. Anyone else have a similar opinion? (I only want
> > to hear from people that agree with me :wink:
> >
> > Mark
> >
> >
> > --
> > Mark C. Miller, Lawrence Livermore National Laboratory
> > email: mailto:miller86@llnl.gov
> > (M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
> > (Th/F) (530)-753-8511 (!!LLNL BUSINESS ONLY!!)
> >
> >
> > _______________________________________________
> > Hdf-forum is for HDF software users discussion.
> > Hdf-forum@hdfgroup.org
> > http://*mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
>
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> Hdf-forum@hdfgroup.org
> http://*mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://*mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Mark C. Miller, Lawrence Livermore National Laboratory
email: mailto:miller86@llnl.gov
(M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
(Th/F) (530)-753-8511 (!!LLNL BUSINESS ONLY!!)


#5

Here it is over 11 years later and I found this thread when I ran into the same issue. What the heck? It seems like the reason to enable lots of warnings is to find and fix potential problems. If your released build has hundreds of warning, aren’t you doing it wrong?


#6

Hi,

First of all, what version of the library are you building?

In the years since the original post, we have reduced the warnings in HDF5 by a significant amount. We’re down to just over 100 in debug builds of the develop branch and around 350 in release builds (depending on compiler, etc.). Most of the remaining warnings concern const correctness and strict overflow.

In general, we tend to use very aggressive warning settings to help keep bugs out of the library, especially given the wide range of platforms we build for and the notorious sloppiness C’s type system, string library, etc. At one point, we did add in a ‘developer warnings’ category that can be enabled at configure time (default: off) where we put the warnings that we consider noise (like gcc’s ‘helpful’ attribute suggestions). We’re a small company, though, and don’t always have the resources to prioritize warning reduction.


#7

Sorry, I didn’t see this reply – surprised I didn’t get some flavor of notification.

This was the latest build I could download as of a few days ago, hdf5-1.12.1

I understand the need to prioritize. But I figured that if you wouldn’t deal with certain types of errors, you wouldn’t have them checked for by default. When I found a similar post from a decade earlier, I was even more surprised.

Thanks.


#8

Personally, I’d rather have them exposed so they continually nag us to fix them (we already suppress anything we consider useless). Turning them off is like getting a big dent in your car and then “fixing” it by parking so you can’t see the dent :slight_smile:

btw, what compiler are you using? clang? gcc? I think clang emits more warnings than gcc. Historically, gcc was much more common among the developers than clang, so we haven’t been as good at noticing/fixing those warnings, though we try our best (ditto for MSVC, icc, pgcc, etc.).


#9

Haha, you make a good point. I don’t want to sweep them under the rug – some do look pretty meaningful. But I was surprised at the volume of such messages.

Looks like it runs gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

I pulled that from config.log – the actual compilation by default doesn’t say much about how it invokes it.