Skip to content

feat: Replaced pragma with include guards#82

Merged
divy9881 merged 1 commit intoapache:masterfrom
EmperorYP7:EmperorYP7/include-guard
Mar 11, 2021
Merged

feat: Replaced pragma with include guards#82
divy9881 merged 1 commit intoapache:masterfrom
EmperorYP7:EmperorYP7/include-guard

Conversation

@EmperorYP7
Copy link
Copy Markdown
Contributor

@EmperorYP7 EmperorYP7 commented Mar 11, 2021

Signed-off-by: Yash Pandey (YP) yash.btech.cs19@iiitranchi.ac.in

This PR fixes #80

Description
Although #pragma once is less prone to errors and is supported by a wide range of compliers, they produce some warnings when compiling with Clang or GCC on MacOS and Linux. I carefully replaced #pragma once and implemented include guards in each cpp file. Here is a glimpse of what it looks like for a file, say foo.cpp:

// Prelude/License

#include "pch.h"
 
#ifndef FOO_CPP
#define FOO_CPP

// The contents of the file

#endif // FOO_CPP

Note on compilation

There were no warnings generated on build for all configurations after implementing this.

Tested on

OS: Darwin arm64 20.3.0
Compiler: Clang 12.0.0
Effective build time: ~12 seconds

@EmperorYP7 EmperorYP7 changed the title [Enhancement] Replaced pragma with include guards feat: Replaced pragma with include guards Mar 11, 2021
@EmperorYP7 EmperorYP7 force-pushed the EmperorYP7/include-guard branch from cdf3667 to 271ba2c Compare March 11, 2021 08:14
@divy9881
Copy link
Copy Markdown
Contributor

Rebase or soft-reset your commits, and make your commit message semantic to pass the semantic-PR CI.
Other-wise I think the PR is fine and can be merged.

Signed-off-by: Yash Pandey (YP) <yash.btech.cs19@iiitranchi.ac.in>
@EmperorYP7 EmperorYP7 force-pushed the EmperorYP7/include-guard branch from 271ba2c to 5a2807b Compare March 11, 2021 08:21
@EmperorYP7
Copy link
Copy Markdown
Contributor Author

I think the CI is happy now. Thanks!

@EmperorYP7 EmperorYP7 marked this pull request as ready for review March 11, 2021 08:24
@divy9881
Copy link
Copy Markdown
Contributor

LGTM

@divy9881 divy9881 merged commit 74fbd8c into apache:master Mar 11, 2021
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.11.6 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@EmperorYP7 EmperorYP7 deleted the EmperorYP7/include-guard branch March 30, 2021 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gcc complains "pragma once" in *.cpp file

2 participants