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

Replace pragma once with explicit header guards #1908

Merged
merged 9 commits into from
Mar 27, 2025

Conversation

joka921
Copy link
Member

@joka921 joka921 commented Mar 26, 2025

While being practical when writing, #pragma once has several downsides.

  1. It is not standardized.
  2. It doesn't work when feeding header files to libclang-based tools.
  3. It can break in very subtle ways in complex build environments.

This PR replaces all occurences of #pragma once by explicit header guards. The header guard macros contain the project name and the full path to the file and the filename, so they are very robust against collisions (e.g. QLEVER_SRC_ENGINE_OPERATION_H for the file src/engine/Operation.h.
The replacement has been performed by a Python script which is also checked in as part of this PR.

Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Copy link

codecov bot commented Mar 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.66%. Comparing base (0a47174) to head (062cde0).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1908   +/-   ##
=======================================
  Coverage   90.66%   90.66%           
=======================================
  Files         411      411           
  Lines       40111    40113    +2     
  Branches     4539     4539           
=======================================
+ Hits        36366    36368    +2     
- Misses       2398     2400    +2     
+ Partials     1347     1345    -2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

joka921 added 8 commits March 27, 2025 08:37
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
This reverts commit fdf2e75

Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
This reverts commit 64bbc4e.
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
@joka921 joka921 marked this pull request as ready for review March 27, 2025 07:52
@sparql-conformance
Copy link

@joka921 joka921 changed the title replace all pragma onces by header guards. Replace pragma once with explicit header guards Mar 27, 2025
@joka921 joka921 merged commit d3b041e into ad-freiburg:master Mar 27, 2025
24 checks passed
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.

1 participant