Skip to content

Commit 01e9131

Browse files
committed
Header files missing "#pragma once"
Fixes #604 Signed-off-by: Roberto Raggi <[email protected]>
1 parent 21797f5 commit 01e9131

File tree

8 files changed

+14
-1
lines changed

8 files changed

+14
-1
lines changed

packages/cxx-gen-ast/src/kwgen.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ export default function kwgen(options: Options) {
2525
} = options;
2626

2727
let out: string[] = [];
28-
const emit = (s: string) => out.push(s);
28+
const emit = (s: string = "") => out.push(s);
2929

3030
if (copyright !== undefined) {
3131
emit("// Generated file by: kwgen.ts");
3232
emit(copyright);
33+
emit();
34+
emit("#pragma once");
3335
}
3436

3537
const keywordsByLength = Map.groupBy(keywords, (s) => s.length);

src/parser/cxx/literals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
// SOFTWARE.
2020

21+
#pragma once
22+
2123
#include <cxx/cxx_fwd.h>
2224

2325
#include <cstdint>

src/parser/cxx/literals_fwd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
// SOFTWARE.
2020

21+
#pragma once
22+
2123
#include <cxx/cxx_fwd.h>
2224

2325
namespace cxx {

src/parser/cxx/name_lookup.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
// SOFTWARE.
2020

21+
#pragma once
22+
2123
#include <cxx/ast_fwd.h>
2224
#include <cxx/names_fwd.h>
2325
#include <cxx/symbols_fwd.h>

src/parser/cxx/private/c_keywords-priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22+
#pragma once
2223
static inline auto classifyC2(const char* s) -> cxx::TokenKind {
2324
if (s[0] == 'd') {
2425
if (s[1] == 'o') {

src/parser/cxx/private/keywords-priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22+
#pragma once
2223
static inline auto classify2(const char* s) -> cxx::TokenKind {
2324
if (s[0] == 'd') {
2425
if (s[1] == 'o') {

src/parser/cxx/private/pp_directives-priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22+
#pragma once
2223
enum class PreprocessorDirectiveKind {
2324
T_IDENTIFIER,
2425
T_DEFINE,

src/parser/cxx/symbol_instantiation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
// SOFTWARE.
2020

21+
#pragma once
22+
2123
#include <cxx/names_fwd.h>
2224
#include <cxx/symbols_fwd.h>
2325
#include <cxx/types_fwd.h>

0 commit comments

Comments
 (0)