Thanks to visit codestin.com
Credit goes to github.com

Skip to content

C++ include guards under src\gc need cleanup for portability #3975

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

Closed
elfring opened this issue Feb 14, 2015 · 14 comments
Closed

C++ include guards under src\gc need cleanup for portability #3975

elfring opened this issue Feb 14, 2015 · 14 comments
Labels
area-GC-coreclr help wanted [up-for-grabs] Good issue for external contributors

Comments

@elfring
Copy link

elfring commented Feb 14, 2015

I would like to point out that identifiers like "__CAPARSER_H__" and "__GC_H" do not fit to the expected naming convention of the C++ language standard.
Would you like to adjust your selection for unique names?

@jkotas
Copy link
Member

jkotas commented Feb 14, 2015

Majority of the CoreCLR code is compiled against PAL headers that isolate from system C++ headers, and so the identifiers cannot collide by design.

It would nice to clean this up for parts of the tree that are likely to evolve into reusable components - GC is one that we know about so far.

@elfring We will be happy to accept PR that cleans up the header guards in files under src\gc. Thanks!

@elfring
Copy link
Author

elfring commented Feb 14, 2015

Should the affected source files be treated in a way so that they should be independent from a specific implementation of a C++ compiler?

@jkotas
Copy link
Member

jkotas commented Feb 14, 2015

We would like to make the GC portable by centralizing all dependencies on a specific execution engine, runtime and compiler in the GC environment (gcenv.h). See comment in https://github.com/dotnet/coreclr/blob/master/src/gc/sample/GCSample.cpp.

There is a number of issues to fix to get there. We prefer this type of work to be split into small incremental pull requests - e.g. fix one particular type of issue per PR.

Also, check the contribution guidelines for GC at https://github.com/dotnet/coreclr/wiki/Garbage-Collector-Contributions

cc: @Maoni0 @brianrob

@Maoni0
Copy link
Member

Maoni0 commented Feb 16, 2015

What Jan said is fine by me. Thanks.

@MattWhilden
Copy link
Contributor

@elfring Did you get a chance to take a stab at this?

Also, would you mind if this title was changed to something like "C++ identifiers under src\gc need cleanup for portability"? We can open other issues to track work in other components as they are identified.

@elfring
Copy link
Author

elfring commented Mar 31, 2015

@MattWhilden: No.

Which safer name pattern do you prefer here?
How do you think about to make your include guards not only standard-compliant but also really unique by appending a kind of UUID?

@MattWhilden
Copy link
Contributor

I don't really have a strong preference. Perhaps @jkotas or @Maoni0 do.

@jkotas
Copy link
Member

jkotas commented Apr 1, 2015

Appending GUIDs makes the code look ugly and it is not really solving much. The remaining 99.9% of names can still collide. I do not think it is something we want to do.

Tweaking the number of underscores to make the guards more compliant with these guidelines is fine with me. Alternatively, changing them to #pragma once is ok too - though it is non-standard, but all current compilers support it.

@elfring
Copy link
Author

elfring commented Apr 1, 2015

Standard-compliant identifiers do not need to win a beauty competition, do they?

@Maoni0
Copy link
Member

Maoni0 commented Apr 2, 2015

I agree with Jan - either #pragma once or getting rid of the double underscore is fine.

@kouvel kouvel changed the title reserved identifier violation C++ include guards under src\gc need cleanup for portability Jul 25, 2017
@msftgits msftgits transferred this issue from dotnet/coreclr Jan 30, 2020
@msftgits msftgits added this to the Future milestone Jan 30, 2020
@mangod9
Copy link
Member

mangod9 commented Sep 22, 2020

@elfring this is a very old issue. The guards appear to be the same and havent caused any issues. Can we close this now?

@elfring
Copy link
Author

elfring commented Sep 22, 2020

@dotnet-policy-service dotnet-policy-service bot added backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity labels Mar 24, 2025
@dotnet-policy-service dotnet-policy-service bot removed this from the Future milestone Apr 8, 2025
@elfring
Copy link
Author

elfring commented Apr 8, 2025

@dotnet-policy-service dotnet-policy-service bot removed no-recent-activity backlog-cleanup-candidate An inactive issue that has been marked for automated closure. labels Apr 8, 2025
@github-actions github-actions bot locked and limited conversation to collaborators May 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-GC-coreclr help wanted [up-for-grabs] Good issue for external contributors
Projects
None yet
Development

No branches or pull requests

6 participants