Skip to content

Commit 6046db1

Browse files
committed
fix: parentheses warnings
Fixes: ``` compiling ../../../../ext/ios_parser/c_lexer/lexer.c ../../../../ext/ios_parser/c_lexer/lexer.c: In function 'process_word': ../../../../ext/ios_parser/c_lexer/lexer.c:41:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 41 | #define IS_DIGIT(C) '0' <= C && C <= '9' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:43:25: note: in expansion of macro 'IS_DIGIT' 43 | #define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C) | ^~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:25: note: in expansion of macro 'IS_DECIMAL' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:306:9: note: in expansion of macro 'IS_WORD' 306 | if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:44:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:306:9: note: in expansion of macro 'IS_WORD' 306 | if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:44:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:306:9: note: in expansion of macro 'IS_WORD' 306 | if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c: In function 'process_decimal': ../../../../ext/ios_parser/c_lexer/lexer.c:41:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 41 | #define IS_DIGIT(C) '0' <= C && C <= '9' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:43:25: note: in expansion of macro 'IS_DIGIT' 43 | #define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C) | ^~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:25: note: in expansion of macro 'IS_DECIMAL' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:320:16: note: in expansion of macro 'IS_WORD' 320 | } else if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:44:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:320:16: note: in expansion of macro 'IS_WORD' 320 | } else if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:44:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:320:16: note: in expansion of macro 'IS_WORD' 320 | } else if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c: In function 'process_integer': ../../../../ext/ios_parser/c_lexer/lexer.c:41:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 41 | #define IS_DIGIT(C) '0' <= C && C <= '9' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:43:25: note: in expansion of macro 'IS_DIGIT' 43 | #define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C) | ^~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:25: note: in expansion of macro 'IS_DECIMAL' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:342:16: note: in expansion of macro 'IS_WORD' 342 | } else if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:44:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:342:16: note: in expansion of macro 'IS_WORD' 342 | } else if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:44:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:342:16: note: in expansion of macro 'IS_WORD' 342 | } else if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c: In function 'is_banner_end_char': ../../../../ext/ios_parser/c_lexer/lexer.c:408:23: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 408 | (0 < lex->pos && '\n' == lex->text[lex->pos - 1] || | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c: In function 'process_root': ../../../../ext/ios_parser/c_lexer/lexer.c:41:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 41 | #define IS_DIGIT(C) '0' <= C && C <= '9' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:43:25: note: in expansion of macro 'IS_DIGIT' 43 | #define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C) | ^~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:25: note: in expansion of macro 'IS_DECIMAL' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:519:16: note: in expansion of macro 'IS_WORD' 519 | } else if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:44:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:519:16: note: in expansion of macro 'IS_WORD' 519 | } else if (IS_WORD(c)) { | ^~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:44:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses] 44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z' | ~~~~~~~~~^~~~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER' 46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) | ^~~~~~~~~ ../../../../ext/ios_parser/c_lexer/lexer.c:519:16: note: in expansion of macro 'IS_WORD' 519 | } else if (IS_WORD(c)) { | ^~~~~~~ ```
1 parent a8f0a5b commit 6046db1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

ext/ios_parser/c_lexer/lexer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ typedef struct LexInfo LexInfo;
3838
#define IS_SPACE(C) C == ' ' || C == '\t' || C == '\r'
3939
#define IS_NEWLINE(C) C == '\n'
4040
#define IS_COMMENT(C) C == '!'
41-
#define IS_DIGIT(C) '0' <= C && C <= '9'
41+
#define IS_DIGIT(C) (('0' <= C) && (C <= '9'))
4242
#define IS_DOT(C) C == '.'
4343
#define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C)
44-
#define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z'
44+
#define IS_LETTER(C) (('a' <= C) && (C <= 'z')) || (('A' <= C) && (C <= 'Z'))
4545
#define IS_PUNCT(C) strchr("-+$:/,()|*#=<>!\"\\&@;%~{}'\"?[]_^`", C)
4646
#define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
4747
#define IS_LEAD_ZERO(C) C == '0'
@@ -405,7 +405,7 @@ static void start_certificate(LexInfo *lex) {
405405

406406
int is_banner_end_char(LexInfo *lex) {
407407
return CURRENT_CHAR(lex) == lex->banner_delimiter &&
408-
(0 < lex->pos && '\n' == lex->text[lex->pos - 1] ||
408+
((0 < lex->pos && '\n' == lex->text[lex->pos - 1]) ||
409409
'\n' == lex->text[lex->pos + 1]);
410410
}
411411

0 commit comments

Comments
 (0)