From b8bc4d145c209b33df8a8ef47a859bd6b899341b Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Mon, 25 Sep 2017 11:18:25 +1000 Subject: Backport: Avoiding comma operator warnings from Clang in lexers. Backport of changeset 6395:1ca06526aa8e. --- lexers/LexCaml.cxx | 4 ++++ lexers/LexPerl.cxx | 12 +++++++----- lexers/LexSML.cxx | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'lexers') diff --git a/lexers/LexCaml.cxx b/lexers/LexCaml.cxx index 038068a7b..1339b5dcc 100644 --- a/lexers/LexCaml.cxx +++ b/lexers/LexCaml.cxx @@ -37,6 +37,10 @@ #include "CharacterSet.h" #include "LexerModule.h" +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wcomma" +#endif + // Since the Microsoft __iscsym[f] funcs are not ANSI... inline int iscaml(int c) {return isalnum(c) || c == '_';} inline int iscamlf(int c) {return isalpha(c) || c == '_';} diff --git a/lexers/LexPerl.cxx b/lexers/LexPerl.cxx index a03eccd59..3bf205f70 100644 --- a/lexers/LexPerl.cxx +++ b/lexers/LexPerl.cxx @@ -121,8 +121,8 @@ static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_Posit // if ch isn't one of '[{(,' we can skip the test if ((ch == '{' || ch == '(' || ch == '['|| ch == ',') && fw < endPos) { - while (ch = static_cast(styler.SafeGetCharAt(fw)), - IsASpaceOrTab(ch) && fw < endPos) { + while (IsASpaceOrTab(ch = static_cast(styler.SafeGetCharAt(fw))) + && fw < endPos) { fw++; } if ((ch == '}' && brace) @@ -137,10 +137,12 @@ static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_Posit static void skipWhitespaceComment(LexAccessor &styler, Sci_PositionU &p) { // when backtracking, we need to skip whitespace and comments - int style; - while ((p > 0) && (style = styler.StyleAt(p), - style == SCE_PL_DEFAULT || style == SCE_PL_COMMENTLINE)) + while (p > 0) { + const int style = styler.StyleAt(p); + if (style != SCE_PL_DEFAULT && style != SCE_PL_COMMENTLINE) + break; p--; + } } static int findPrevLexeme(LexAccessor &styler, Sci_PositionU &bk, int &style) { diff --git a/lexers/LexSML.cxx b/lexers/LexSML.cxx index 1cb00f91d..ed67300d2 100644 --- a/lexers/LexSML.cxx +++ b/lexers/LexSML.cxx @@ -24,6 +24,10 @@ #include "CharacterSet.h" #include "LexerModule.h" +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wcomma" +#endif + inline int issml(int c) {return isalnum(c) || c == '_';} inline int issmlf(int c) {return isalpha(c) || c == '_';} inline int issmld(int c) {return isdigit(c) || c == '_';} -- cgit v1.2.3