Skip to content
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

Don't predeclare enums with C++ #2193

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

samuel40791765
Copy link
Contributor

Issues:

Addresses CryptoAlg-2693

Description of changes:

We encountered this when trying to compile Xtrabackup on gcc versions lower than 10. Apparently scoped enums are a C++11 feature, which the compiler can't understand without additional linker flags.

/home/ubuntu/workplace/percona-xtrabackup/aws-lc/test_build_dir/include/openssl/ssl.h:174:30: warning: scoped enums only available with ‘-std=c++11’ or ‘-std=gnu++11’
  174 | #define BORINGSSL_ENUM_INT : int
      |                              ^~~
...
      |                              ^~~
/home/ubuntu/workplace/percona-xtrabackup/aws-lc/test_build_dir/include/openssl/ssl.h:4783:31: note: in expansion of macro ‘BORINGSSL_ENUM_INT’
 4783 | enum ssl_select_cert_result_t BORINGSSL_ENUM_INT {
      |                               ^~~~~~~~~~~~~~~~~~
make[2]: *** [libmysql/CMakeFiles/clientlib.dir/build.make:149: libmysql/CMakeFiles/clientlib.dir/__/sql-common/client_authentication.cc.o] Error 1
make[2]: Leaving directory '/home/ubuntu/workplace/percona-xtrabackup/build'

We also encountered this in 42a8dba, which prompted us to move it to ssl.h. Upon closer examination, I don't think the C++11 usage is a necessity especially with the pure C fallback that was included. Predeclaring enums reduces compilation dependencies and build times, but our build seems to work fine without it. Removing this would let us encounter less build issues with projects that aren't expecting C++ in our header files.

Call-outs:

N/A

Testing:

CI

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@codecov-commenter
Copy link

codecov-commenter commented Feb 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.03%. Comparing base (bd09b3a) to head (b0f8bd6).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2193      +/-   ##
==========================================
- Coverage   79.03%   79.03%   -0.01%     
==========================================
  Files         612      612              
  Lines      106064   106066       +2     
  Branches    14984    14986       +2     
==========================================
- Hits        83829    83826       -3     
- Misses      21581    21587       +6     
+ Partials      654      653       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

justsmth
justsmth previously approved these changes Feb 13, 2025
@justsmth
Copy link
Contributor

Pre-push check is failing:

[Container] 2025/02/13 01:52:19.380053 Running command (cd util && go run ./doc.go)
Failed to generate output: while parsing include/openssl/ssl.h: comment for "SSL_CTX_get0_chain" doesn't seem to match line include/openssl/ssl.h:1274

exit status 1

@samuel40791765 samuel40791765 marked this pull request as ready for review February 13, 2025 18:14
@samuel40791765 samuel40791765 requested a review from a team as a code owner February 13, 2025 18:14
Copy link
Contributor

@andrewhop andrewhop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update c99_gcc_test.sh to also check for C++ header compatibility (and maybe rename the file). Also double check that it's running, I'm not sure anything defines AWSLC_C99_TEST right now....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants