New feature, warning on n=n++ etc.
Tue Jun 16 13:28:00 GMT 1998
A first attempt, at a first submission to egcs. I have signed a
copyright assignment, posted it to RMS and recieved a reply confirming
The feature is to catch probably undefined syntax. The following
cases are flagged, where Fail denotes a warning.
a = a++ ; /* Fail */
a = --a ; /* Fail */
a = ++a + b ; /* Fail */
a = a-- + b ; /* Fail */
a = (a++ && 4) ; /* shouldn't Fail but does */
a[n]=b[n++] ; /* Fail */
a[--n]=b[n] ; /* Fail */
a[++n]=b[--n] ; /* Fail */
c[n][n]=c[n][n]++ ; /* should fail but doesn't */
c[n][p]=c[n][n++] ; /* Fail */ /* if [n][n] then fails twice */
*ptr++ = (int)ptr++ ; /* Fail */
ptr->a = ptr->a++ ; /* should fail but doesn't */
ptr->a = (int)(ptr++) ; /* Fail */
len = sprintf (ans, "%d", len++) ; /* Fail */
*ptr++ = fn(*ptr) ; /* should fail but doesn't */
a = b = a++ ; /* Fail */
b = a = --b ; /* Fail */
a = 1 + (a=1) ; /* Fail */
a = (a=b) ; /* Fail */
a = (a=b) + 1 ; /* Fail */
A changelog entry might look like : ?
Tue Jun 16 19:41:18 1998 Michael Meeks (email@example.com)
* c-toplev.c: Added -Wundefined to lang_options.
* c-decl.c (c_decode_option): Added -Wundefined, added warn_undefined
* c-iterate.c (collect_iterators): Broke out operand classification code
* tree.c (get_max_tree_operands): Returns max. valid number of operands
used solely in parse tree.
* tree.h: appended prototype.
* c-typeck.c (build_modify_expr): Added call to check_modify_expr
(check_modify_expr): Created, checks and warns for some undefined syntax.
I hope this is useful,
firstname.lastname@example.org <><, Pseudo Engineer, itinerant idiot
More information about the Gcc-patches