howto punctually disable warnings "control reaches end of non-void function"

Markus Werle markus@lufmech.rwth-aachen.de
Fri Jul 20 07:06:00 GMT 2001


Hi!

I sometimes need functions of the form

void SomeFuntionYetNOTReady() {
 SHOULD_NOT_BE_REACHED();

with the macro defined as:

#define SHOULD_NOT_BE_REACHED()   {                             \
  std::cerr << "This function should not be reached\n"          \
       << __FILE__ << " line " << __LINE__ << std::endl;        \
  exit(1);  }

gcc -Wall then complains correctly for a wrong return type
(better missing return type).

Is there a possibility to change the macro definition in a way
that quiets gcc at those places while still complaining at others?
Please do not propose to introduce a retunr type as argument
in the macro - too much work then. I need the singel point solution here

even if I have to use pragma.

Markus



More information about the Gcc-help mailing list