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]

Lint-style comments, more generally


Seeing how long the thread on gcc-patches on what comments
-Wimplicit-fallthrough should recognize has gotten, I thought it might
be a good idea to start a discussion on lint-style comments more
generally. Instead of just limiting the use of lint-style comments to
-Wimplicit-fallthrough, why not split the recognition of it off into a
separate switch (-flint-style-comments or -Wlint-style-comments) that
can be taken advantage of by other warnings? Here are some examples
I've seen in actual code:
/*NOTREACHED*/ to tell the compiler that code is unreachable; could be
useful if the -Wunreachable-code warning were to be revived. I
suggested making this equivalent to __builtin_unreachable() on a bug
on bugzilla, but apparently that also affects codegen, so instead of
making the two exactly equivalent, how about if the comment just
silences the warning and leaves the codegen the same?
/*ARGSUSED*/ which is pretty similar to __attribute__((unused)) or
#pragma unused; could also be used to silence -Wunused-parameter
/*VARARGS*/ for functions with a variable number of arguments; I'm not
aware of any GCC warnings that this one would currently silence.

Further links I found by Googling:
http://csweb.cs.wfu.edu/~torgerse/Kokua/More_SGI/007-0701-150/sgi_html/apb.html
(lists some other ones I hadn't seen)
http://www.splint.org/manual/manual.html#annotations (scroll down to
the "Traditional Lint Comments" section)
https://docs.freebsd.org/info/cpp/cpp.info.Invocation.html (The
FreeBSD cpp seems to have a '-lint' flag; apparently their GCC
supports a #pragma lint)
http://www.fnal.gov/docs/products/gcc/v2_95_2/cpp.info,.Invocation.html
(seems to be the same as the previous, but with some further
commentary about option naming)

Anyways, what do people think?


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