-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] Fix GCC compilation failure caused by warning macro #14402
Merged
merlimat
merged 1 commit into
apache:master
from
BewareMyPower:bewaremypower/cpp-gcc-version-error
Feb 22, 2022
Merged
[C++] Fix GCC compilation failure caused by warning macro #14402
merlimat
merged 1 commit into
apache:master
from
BewareMyPower:bewaremypower/cpp-gcc-version-error
Feb 22, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Motivation When I tried to build the C++ client with GCC 7.3 and when warnings are printed (because `BOOST_ARCH_X86_64` is not defined), the compilation failed with: ``` #warning “BOOST_ARCH_X86_64 is not defined, CRC32C SSE4.2 will be disabled” ^~~~~~~ cc1plus: error: unrecognized command line option '-Wno-stringop-truncation' [-Werror] cc1plus: all warnings being treated as errors ``` It seems to be a bug before GCC 8.1. I added `-DCMAKE_VERBOSE_MAKEFILE=ON` to CMake command and see the full compile command: ``` -Wno-error -Wall -Wformat-security -Wvla -Werror -Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp -Wno-stringop-truncation ``` See https://github.com/apache/pulsar/blob/b829a4ce121268f55748bbdd6f19ac36129e7dab/pulsar-client-cpp/CMakeLists.txt#L105-L106 For GCC > 4.9, `-Wno-stringop-truncation` option was added. However, when a message was printed by `#warning` macro, it would fail with the strange error message. The simplest way to reproduce the bug is compiling following code: ```c++ #warnings "hello" int main() {} ``` You can paste the code above to https://godbolt.org/, select any GCC compiler whose version is lower than 8.0, then add the following options: ``` -Werror -Wno-error=cpp -Wno-stringop-truncation ``` The compilation failed for x86-64 gcc 7.5 while it succeeded for 8.1. ### Modifications Only add the `-Wno-stringop-truncation` option for GCC >= 8.1.
BewareMyPower
requested review from
merlimat,
lhotari,
aahmed-se,
k2la and
massakam
February 21, 2022 16:17
merlimat
approved these changes
Feb 22, 2022
michaeljmarshall
pushed a commit
that referenced
this pull request
Feb 24, 2022
### Motivation When I tried to build the C++ client with GCC 7.3 and when warnings are printed (because `BOOST_ARCH_X86_64` is not defined), the compilation failed with: ``` #warning “BOOST_ARCH_X86_64 is not defined, CRC32C SSE4.2 will be disabled” ^~~~~~~ cc1plus: error: unrecognized command line option '-Wno-stringop-truncation' [-Werror] cc1plus: all warnings being treated as errors ``` It seems to be a bug before GCC 8.1. I added `-DCMAKE_VERBOSE_MAKEFILE=ON` to CMake command and see the full compile command: ``` -Wno-error -Wall -Wformat-security -Wvla -Werror -Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp -Wno-stringop-truncation ``` See https://github.com/apache/pulsar/blob/b829a4ce121268f55748bbdd6f19ac36129e7dab/pulsar-client-cpp/CMakeLists.txt#L105-L106 For GCC > 4.9, `-Wno-stringop-truncation` option was added. However, when a message was printed by `#warning` macro, it would fail with the strange error message. The simplest way to reproduce the bug is compiling following code: ```c++ #warnings "hello" int main() {} ``` You can paste the code above to https://godbolt.org/, select any GCC compiler whose version is lower than 8.0, then add the following options: ``` -Werror -Wno-error=cpp -Wno-stringop-truncation ``` The compilation failed for x86-64 gcc 7.5 while it succeeded for 8.1. ### Modifications Only add the `-Wno-stringop-truncation` option for GCC >= 8.1. (cherry picked from commit 958fc78)
codelipenghui
pushed a commit
that referenced
this pull request
Feb 25, 2022
### Motivation When I tried to build the C++ client with GCC 7.3 and when warnings are printed (because `BOOST_ARCH_X86_64` is not defined), the compilation failed with: ``` #warning “BOOST_ARCH_X86_64 is not defined, CRC32C SSE4.2 will be disabled” ^~~~~~~ cc1plus: error: unrecognized command line option '-Wno-stringop-truncation' [-Werror] cc1plus: all warnings being treated as errors ``` It seems to be a bug before GCC 8.1. I added `-DCMAKE_VERBOSE_MAKEFILE=ON` to CMake command and see the full compile command: ``` -Wno-error -Wall -Wformat-security -Wvla -Werror -Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp -Wno-stringop-truncation ``` See https://github.com/apache/pulsar/blob/b829a4ce121268f55748bbdd6f19ac36129e7dab/pulsar-client-cpp/CMakeLists.txt#L105-L106 For GCC > 4.9, `-Wno-stringop-truncation` option was added. However, when a message was printed by `#warning` macro, it would fail with the strange error message. The simplest way to reproduce the bug is compiling following code: ```c++ #warnings "hello" int main() {} ``` You can paste the code above to https://godbolt.org/, select any GCC compiler whose version is lower than 8.0, then add the following options: ``` -Werror -Wno-error=cpp -Wno-stringop-truncation ``` The compilation failed for x86-64 gcc 7.5 while it succeeded for 8.1. ### Modifications Only add the `-Wno-stringop-truncation` option for GCC >= 8.1. (cherry picked from commit 958fc78)
nicoloboschi
pushed a commit
to nicoloboschi/pulsar
that referenced
this pull request
Mar 1, 2022
### Motivation When I tried to build the C++ client with GCC 7.3 and when warnings are printed (because `BOOST_ARCH_X86_64` is not defined), the compilation failed with: ``` #warning “BOOST_ARCH_X86_64 is not defined, CRC32C SSE4.2 will be disabled” ^~~~~~~ cc1plus: error: unrecognized command line option '-Wno-stringop-truncation' [-Werror] cc1plus: all warnings being treated as errors ``` It seems to be a bug before GCC 8.1. I added `-DCMAKE_VERBOSE_MAKEFILE=ON` to CMake command and see the full compile command: ``` -Wno-error -Wall -Wformat-security -Wvla -Werror -Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp -Wno-stringop-truncation ``` See https://github.com/apache/pulsar/blob/b829a4ce121268f55748bbdd6f19ac36129e7dab/pulsar-client-cpp/CMakeLists.txt#L105-L106 For GCC > 4.9, `-Wno-stringop-truncation` option was added. However, when a message was printed by `#warning` macro, it would fail with the strange error message. The simplest way to reproduce the bug is compiling following code: ```c++ #warnings "hello" int main() {} ``` You can paste the code above to https://godbolt.org/, select any GCC compiler whose version is lower than 8.0, then add the following options: ``` -Werror -Wno-error=cpp -Wno-stringop-truncation ``` The compilation failed for x86-64 gcc 7.5 while it succeeded for 8.1. ### Modifications Only add the `-Wno-stringop-truncation` option for GCC >= 8.1.
gaoran10
pushed a commit
that referenced
this pull request
Mar 1, 2022
### Motivation When I tried to build the C++ client with GCC 7.3 and when warnings are printed (because `BOOST_ARCH_X86_64` is not defined), the compilation failed with: ``` #warning “BOOST_ARCH_X86_64 is not defined, CRC32C SSE4.2 will be disabled” ^~~~~~~ cc1plus: error: unrecognized command line option '-Wno-stringop-truncation' [-Werror] cc1plus: all warnings being treated as errors ``` It seems to be a bug before GCC 8.1. I added `-DCMAKE_VERBOSE_MAKEFILE=ON` to CMake command and see the full compile command: ``` -Wno-error -Wall -Wformat-security -Wvla -Werror -Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp -Wno-stringop-truncation ``` See https://github.com/apache/pulsar/blob/b829a4ce121268f55748bbdd6f19ac36129e7dab/pulsar-client-cpp/CMakeLists.txt#L105-L106 For GCC > 4.9, `-Wno-stringop-truncation` option was added. However, when a message was printed by `#warning` macro, it would fail with the strange error message. The simplest way to reproduce the bug is compiling following code: ```c++ #warnings "hello" int main() {} ``` You can paste the code above to https://godbolt.org/, select any GCC compiler whose version is lower than 8.0, then add the following options: ``` -Werror -Wno-error=cpp -Wno-stringop-truncation ``` The compilation failed for x86-64 gcc 7.5 while it succeeded for 8.1. ### Modifications Only add the `-Wno-stringop-truncation` option for GCC >= 8.1. (cherry picked from commit 958fc78)
Nicklee007
pushed a commit
to Nicklee007/pulsar
that referenced
this pull request
Apr 20, 2022
### Motivation When I tried to build the C++ client with GCC 7.3 and when warnings are printed (because `BOOST_ARCH_X86_64` is not defined), the compilation failed with: ``` #warning “BOOST_ARCH_X86_64 is not defined, CRC32C SSE4.2 will be disabled” ^~~~~~~ cc1plus: error: unrecognized command line option '-Wno-stringop-truncation' [-Werror] cc1plus: all warnings being treated as errors ``` It seems to be a bug before GCC 8.1. I added `-DCMAKE_VERBOSE_MAKEFILE=ON` to CMake command and see the full compile command: ``` -Wno-error -Wall -Wformat-security -Wvla -Werror -Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp -Wno-stringop-truncation ``` See https://github.com/apache/pulsar/blob/b829a4ce121268f55748bbdd6f19ac36129e7dab/pulsar-client-cpp/CMakeLists.txt#L105-L106 For GCC > 4.9, `-Wno-stringop-truncation` option was added. However, when a message was printed by `#warning` macro, it would fail with the strange error message. The simplest way to reproduce the bug is compiling following code: ```c++ #warnings "hello" int main() {} ``` You can paste the code above to https://godbolt.org/, select any GCC compiler whose version is lower than 8.0, then add the following options: ``` -Werror -Wno-error=cpp -Wno-stringop-truncation ``` The compilation failed for x86-64 gcc 7.5 while it succeeded for 8.1. ### Modifications Only add the `-Wno-stringop-truncation` option for GCC >= 8.1.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/build
cherry-picked/branch-2.8
Archived: 2.8 is end of life
cherry-picked/branch-2.9
Archived: 2.9 is end of life
doc-not-needed
Your PR changes do not impact docs
release/2.8.3
release/2.9.2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
When I tried to build the C++ client with GCC 7.3 and when warnings are
printed (because
BOOST_ARCH_X86_64
is not defined), the compilationfailed with:
It seems to be a bug before GCC 8.1. I added
-DCMAKE_VERBOSE_MAKEFILE=ON
to CMake command and see the full compilecommand:
See
pulsar/pulsar-client-cpp/CMakeLists.txt
Lines 105 to 106 in b829a4c
For GCC > 4.9,
-Wno-stringop-truncation
option was added. However,when a message was printed by
#warning
macro, it would fail with thestrange error message.
The simplest way to reproduce the bug is compiling following code:
You can paste the code above to https://godbolt.org/, select any GCC
compiler whose version is lower than 8.0, then add the following
options:
The compilation failed for x86-64 gcc 7.5 while it succeeded for 8.1.
Modifications
Only add the
-Wno-stringop-truncation
option for GCC >= 8.1.