Skip to content

Commit

Permalink
Merge pull request #29 from phoppermann/pragma-once
Browse files Browse the repository at this point in the history
CppGenerator: use #pragma once
  • Loading branch information
leif81 authored Apr 19, 2021
2 parents 11f88b3 + 592c648 commit 8e1f8f8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/main/java/edu/nps/moves/xmlpg/CppGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,8 @@ public void writeHeaderFile(GeneratedClass aClass) {
outputFile.createNewFile();
PrintWriter pw = new PrintWriter(outputFile);

// Write the usual #ifdef to prevent multiple inclusions by the preprocessor
pw.println("#ifndef " + aClass.getName().toUpperCase() + "_H");
pw.println("#define " + aClass.getName().toUpperCase() + "_H");
// prevent multiple inclusions by the preprocessor
pw.println("#pragma once");
pw.println();

// Write includes for any classes we may reference. this generates multiple #includes if we
Expand Down Expand Up @@ -410,9 +409,6 @@ public void writeHeaderFile(GeneratedClass aClass) {
pw.println("}");
}

// Close if #ifndef statement that prevents multiple #includes
pw.println("\n#endif");

this.writeLicenseNotice(pw);

pw.flush();
Expand Down

0 comments on commit 8e1f8f8

Please sign in to comment.