This is the mail archive of the gcc-help@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]

assertion warnings


Is there any way to get gcc to generate warnings for the following code?
-Wall gives no complaints at all.
I expect that it's asking too much to get a warning for the first assertion, but
the other two seem to be pretty obvious candidates for a warning.


#include <assert.h>
int
foo(int *x)
{
   *x = *x+1;
   return *x;
}

int
main()
{
   int x;
   assert(foo(&x));
   assert(x=2);
   assert(x++);
   return 0;
}


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