|
Line
Link Here
|
| 0 |
-- c-typeck.c |
0 |
++ c-typeck.c |
|
Lines 2687-2697
parser_build_binary_op (enum tree_code c
Link Here
|
| 2687 |
} |
2687 |
} |
| 2688 |
|
2688 |
|
| 2689 |
/* Warn about comparisons against string literals, with the exception |
2689 |
/* Warn about comparisons against string literals, with the exception |
| 2690 |
of testing for equality or inequality of a string literal with NULL. */ |
2690 |
of testing for equality or inequality of a string literal with NULL |
|
|
2691 |
or testing for equality or inequality of two different string literals. */ |
| 2691 |
if (code == EQ_EXPR || code == NE_EXPR) |
2692 |
if (code == EQ_EXPR || code == NE_EXPR) |
| 2692 |
{ |
2693 |
{ |
| 2693 |
if ((code1 == STRING_CST && !integer_zerop (arg2.value)) |
2694 |
if (((code1 == STRING_CST && !integer_zerop (arg2.value)) |
| 2694 |
|| (code2 == STRING_CST && !integer_zerop (arg1.value))) |
2695 |
|| (code2 == STRING_CST && !integer_zerop (arg1.value))) |
|
|
2696 |
&& !(code1 == STRING_CST && code2 == STRING_CST |
| 2697 |
&& strcmp(TREE_STRING_POINTER(arg1.value), |
| 2698 |
TREE_STRING_POINTER(arg2.value)) != 0)) |
| 2695 |
warning (OPT_Wstring_literal_comparison, |
2699 |
warning (OPT_Wstring_literal_comparison, |
| 2696 |
"comparison with string literal"); |
2700 |
"comparison with string literal"); |
| 2697 |
} |
2701 |
} |