Skip to content

Commit

Permalink
Fix extra semicolon outside of a function in NO_SANITIZE
Browse files Browse the repository at this point in the history
```
internal/sanitizers.h:57:26: error: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
   57 |     COMPILER_WARNING_PUSH; \
      |                          ^
```

and so many.

Remove semicolons following pragma, and repeat the given declaration
at the end to consume a semicolon following the macro call.  As many
`NO_SANITIZE` calls including bigdecimal that is a gem have a trailing
semicolon, it was not able to move the semicolon inside `NO_SANITIZE`.
  • Loading branch information
nobu committed Oct 8, 2024
1 parent 1f7fd8b commit 8e98440
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions internal/sanitizers.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@
# include "internal/warnings.h"
# undef NO_SANITIZE
# define NO_SANITIZE(x, y) \
COMPILER_WARNING_PUSH; \
COMPILER_WARNING_IGNORED(-Wattributes); \
COMPILER_WARNING_PUSH \
COMPILER_WARNING_IGNORED(-Wattributes) \
__attribute__((__no_sanitize__(x))) y; \
COMPILER_WARNING_POP
COMPILER_WARNING_POP \
y
#endif

#ifndef NO_SANITIZE
Expand Down
3 changes: 2 additions & 1 deletion parser_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ nonempty_memcpy(void *dest, const void *src, size_t n)
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
__attribute__((__no_sanitize__(x))) y; \
_Pragma("GCC diagnostic pop")
_Pragma("GCC diagnostic pop") \
y
#endif

#ifndef NO_SANITIZE
Expand Down

0 comments on commit 8e98440

Please sign in to comment.