This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: named warnings & individual warning control


> I have for years wanted the ability to turn individual warnings off
> for small parts of a file.

My original proposal included that as a "future feature" by providing
for an API to request a warning state token, which would be passed to
future calls to warn(), to keep track of which warnings were enabled.
It was one of the first casualties :-(

But it looks like it's an all or nothing choice here, since people
seem unwilling to add partial functionality now as a step towards
something better in the future.  Given those options, I see why so far
the choice has been to do nothing.

> Seriously.  We already have a solution to that problem -- it's
> modifying the command line switches used to compile the file.

In some cases, it's more managable to have a per-file pragma that
tweaks the settings than to sacrifice warnings for all files in a
directory or mess with per-file makefile variables.  Especially if the
pragmas have to be gcc-version-sensitive, where #ifs are needed to
select the right ones.

> If it applies to individual lines (i.e., arbitrary code until the
> next pragma that changes it or the end of the file), we will use it.

That was the original idea, and also the most work to implement.
Without a centralized message database (with or without text strings),
we can't have a concept of a warning state, and thus can't keep track
of warning state on a line by line basis.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]