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]

Re: Warnings in the C++ Front-End and GCC in General


>#pragma gcc_warn_once (number)

Why not

#pragma gcc_warn_N (number, N)

or, for that matter,

#pragma gcc_warn_map (number, warn_0, warn_1, warn_2, ...)

where warn_0 is nonzero to warn about the next instance, ditto warn_1
abort the instance after that, and so on?  That'd allow including
somebody else's code via #include without having to modify it,
covering most such cases no matter how many warnings the code might
trigger.

Further,

#pragma gcc_warn_range (number, first_linenum, last_linenum)

to control whether a particular warning should appear when it pertains
to source text between the given line numbers would be even more
useful.

Add to that the need to specify lineno/filename combinations (since
that's what gcc maintains internally), and you've really got
something.

In fact, what'll *really* be useful is something like

#pragma gcc_warn_once_after (first_number, after_number)

to control warning about the first after_number that appears after
the first first_number warning, because that'll allow people
to write much longer-term code (since many warnings are essentially
triggered by stuff that is accompanied by prior warnings, and
these, in turn, can be version-dependent and/or target-machine
dependent, etc.).

Now, offer a complete facility integrating all of the above, and
anything else people might suggest, and we've really got something
we can boast about!


Come on, we're talking about designing a finite automata that
produces assembly code and diagnostic output here, however much
we might "dress it up" as something else.  We might as well
get it "right" in the first place and offer a C *interpreter*
in which people can write code directing precisely how to have
other input converted to assembler/diagnostics.  (Or, to keep
the size of the interpret down, we could offer Forth or some
such thing.)

What does *any* of this have to do with compilers for *languages*
like C, C++, Fortran, et al?

        tq vm, (burley)


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