Skip to content
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

Add include guards to all headers #2042

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
gcc-build-test:
name: gcc build & test
needs: [clang-formatting-check]
needs: [clang-formatting-check, header-include-guard-check]
runs-on: kuzu-self-hosted-testing
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:

clang-build-test:
name: clang build & test
needs: [clang-formatting-check]
needs: [clang-formatting-check, header-include-guard-check]
runs-on: kuzu-self-hosted-testing
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:

msvc-build-test:
name: msvc build & test
needs: [clang-formatting-check]
needs: [clang-formatting-check, header-include-guard-check]
runs-on: self-hosted-windows
env:
# Shorten build path as much as possible
Expand Down Expand Up @@ -195,6 +195,15 @@ jobs:
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
make javatest NUM_THREADS=18

header-include-guard-check:
name: header include guard check
runs-on: kuzu-self-hosted-testing
steps:
- uses: actions/checkout@v3

- name: Check headers for include guards
run: ./scripts/check-headers.sh src/include

clang-formatting-check:
name: clang-format check
runs-on: kuzu-self-hosted-testing
Expand Down
7 changes: 7 additions & 0 deletions scripts/check-headers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# -L returns 0 if there are any matches, which means any file containing the
# pragma will cause this to give a exit status of 1. It's a bit hacky, but we
# just pipe this to grep again, which exits with 0 if there are any lines and 1
# otherwise.
! grep -rL "^#pragma once" $1 | grep ""
2 changes: 2 additions & 0 deletions src/include/binder/bound_statement_rewriter.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "bound_statement.h"

namespace kuzu {
Expand Down
2 changes: 2 additions & 0 deletions src/include/binder/rewriter/with_clause_projection_rewriter.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "binder/bound_statement_visitor.h"

namespace kuzu {
Expand Down
2 changes: 2 additions & 0 deletions src/include/common/types/value/nested.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include <cstdint>

#include "common/api.h"
Expand Down
2 changes: 2 additions & 0 deletions src/include/common/types/value/recursive_rel.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "common/api.h"

namespace kuzu {
Expand Down
2 changes: 2 additions & 0 deletions src/include/common/types/value/rel.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include <cstdint>
#include <memory>
#include <string>
Expand Down
2 changes: 2 additions & 0 deletions src/include/expression_evaluator/expression_evaluator_utils.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "binder/expression/expression.h"
#include "expression_evaluator.h"

Expand Down
2 changes: 2 additions & 0 deletions src/include/main/kuzu_fwd.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include <cstdint>

namespace kuzu {
Expand Down
2 changes: 2 additions & 0 deletions src/include/optimizer/factorization_rewriter.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "logical_operator_visitor.h"
#include "planner/logical_plan/logical_plan.h"

Expand Down
2 changes: 2 additions & 0 deletions src/include/optimizer/logical_operator_collector.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "logical_operator_visitor.h"

namespace kuzu {
Expand Down
2 changes: 2 additions & 0 deletions src/include/planner/join_order/cost_model.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "planner/logical_plan/logical_plan.h"

namespace kuzu {
Expand Down
2 changes: 2 additions & 0 deletions src/include/storage/store/struct_node_column.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "node_column.h"
#include "storage/store/table_statistics.h"

Expand Down