OpenAPITools / OpenAPITools/openapi-generator
[REQ] [C++][Pistache] Header guards not unique
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
The code generated by the C++ pistache generator includes header guards in each header. The name of these header guards are based only on the class contained within the header. E.g.:
#ifndef Animal_H_
#define Animal_H_
namespace a {
namespace b {
class Animal {
};
}
}
#endif /* Animal_H_ */
Such header guards can easily conflict with guards in existing code (which could come from another library, e.g. imagine a class named vector, which exists in tons of libraries).
I would suggest including at least each of the namespaces in the header guard variable's name (i.e. #ifndef a_b_Animal_H_). Or, IMHO even better, use #pragma once which avoids the whole issue altogether.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the C++ Pistache generator templates or entry points that emit header guards, then inspect generated headers like the Animal example. Confirm that guards remain unique when classes share names across namespaces; done means the generated guards include sufficient namespace context or use pragma once, with the resulting generated output checked for conflicts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100