[PATCH 2/9] style: reduce scopes

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
* src/scan-gram.l (STRING_GROW_ESCAPE): Move the static_assert about
type sizes here.
---
 src/scan-gram.l | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/scan-gram.l b/src/scan-gram.l
index 1bbcfd7d..655eee70 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -86,6 +86,7 @@ static boundary scanner_cursor;
 
 #define STRING_GROW_ESCAPE(Char)                                \
   do {                                                          \
+    verify (UCHAR_MAX < ULONG_MAX);                             \
     long c = Char;                                              \
     if (0 < c && c <= UCHAR_MAX)                                \
       obstack_1grow (&obstack_for_string, c);                   \
@@ -653,12 +654,10 @@ eqopt    ({sp}=)?
 <SC_ESCAPED_CHARACTER,SC_ESCAPED_STRING,SC_ESCAPED_TSTRING>
 {
   \\[0-7]{1,3} {
-    verify (UCHAR_MAX < ULONG_MAX);
     STRING_GROW_ESCAPE (strtol (yytext + 1, NULL, 8));
   }
 
   \\x[0-9abcdefABCDEF]+ {
-    verify (UCHAR_MAX < ULONG_MAX);
     STRING_GROW_ESCAPE (strtol (yytext + 2, NULL, 16));
   }
 
-- 
2.27.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.