Skip to content

[C++] Extra semicolon warning from ARROW_SUPPRESS_DEPRECATION_WARNING macro with -Wpedantic #50487

Description

@thisisnic

This shows up when building the R package:

/home/nic/arrow-dist/include/arrow/util/macros.h:160:35: warning: extra ‘;’ [-Wpedantic]
     160 |     _Pragma("GCC diagnostic push");          \
         |                                   ^
   /home/nic/arrow-dist/include/arrow/compute/api_vector.h:277:3: note: in expansion of macro ‘ARROW_SUPPRESS_DEPRECATION_WARNING’
     277 |   ARROW_SUPPRESS_DEPRECATION_WARNING
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ARROW_SUPPRESS_DEPRECATION_WARNING macro for GCC has a trailing semicolon after the first _Pragma directive:

# define ARROW_SUPPRESS_DEPRECATION_WARNING \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")

Since _Pragma is a complete directive, the semicolon becomes an empty statement, triggering -Wpedantic warnings wherever the macro is used (e.g. api_vector.h:134):

/arrow/util/macros.h:160:35: warning: extra ';' [-Wpedantic]

The same issue exists on the clang branch (line 155).

Removing the trailing semicolons from the _Pragma lines in the macro definition would fix it.

Authored by Claude, reviewed by thisisnic

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions