Skip to content

Commit

Permalink
Merge pull request #39452 from jbytheway/cata_header_guard_check
Browse files Browse the repository at this point in the history
Add clang-tidy header guard check
  • Loading branch information
kevingranade authored Apr 14, 2020
2 parents a015c70 + c034a56 commit 32e6aab
Show file tree
Hide file tree
Showing 322 changed files with 1,387 additions and 925 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ readability-*,\
-readability-redundant-declaration,\
"
WarningsAsErrors: '*'
HeaderFilterRegex: '(src|test).*'
HeaderFilterRegex: '(src|test|tools).*'
FormatStyle: none
CheckOptions:
- key: readability-uppercase-literal-suffix.NewSuffixes
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ ADD_DEFINITIONS(-DCMAKE)

if (NOT ${GIT_VERSION} MATCHES GIT-NOTFOUND)
string(REPLACE "-NOTFOUND" "" GIT_VERSION ${GIT_VERSION})
FILE(WRITE ${CMAKE_SOURCE_DIR}/src/version.h "\#define VERSION \"${GIT_VERSION}\"\n")
FILE(WRITE ${CMAKE_SOURCE_DIR}/src/version.h
"// NOLINT(cata-header-guard)\n\#define VERSION \"${GIT_VERSION}\"\n")
MESSAGE(STATUS "${PROJECT_NAME} build version is : ${GIT_VERSION}\n")
ADD_DEFINITIONS(-DGIT_VERSION)
ELSE (NOT ${GIT_VERSION} MATCHES GIT-NOTFOUND)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ version:
@( VERSION_STRING=$(VERSION) ; \
[ -e ".git" ] && GITVERSION=$$( git describe --tags --always --dirty --match "[0-9A-Z]*.[0-9A-Z]*" ) && VERSION_STRING=$$GITVERSION ; \
[ -e "$(SRC_DIR)/version.h" ] && OLDVERSION=$$(grep VERSION $(SRC_DIR)/version.h|cut -d '"' -f2) ; \
if [ "x$$VERSION_STRING" != "x$$OLDVERSION" ]; then echo "#define VERSION \"$$VERSION_STRING\"" | tee $(SRC_DIR)/version.h ; fi \
if [ "x$$VERSION_STRING" != "x$$OLDVERSION" ]; then printf '// NOLINT(cata-header-guard)\n#define VERSION "%s"\n' "$$VERSION_STRING" | tee $(SRC_DIR)/version.h ; fi \
)

# Unconditionally create the object dir on every invocation.
Expand Down
6 changes: 3 additions & 3 deletions src/achievement.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef CATA_ACHIEVEMENT_H
#define CATA_ACHIEVEMENT_H
#ifndef CATA_SRC_ACHIEVEMENT_H
#define CATA_SRC_ACHIEVEMENT_H

#include <list>
#include <string>
Expand Down Expand Up @@ -123,4 +123,4 @@ class achievements_tracker : public event_subscriber
std::unordered_map<string_id<achievement>, achievement_state> achievements_status_;
};

#endif // CATA_ACHIEVEMENT_H
#endif // CATA_SRC_ACHIEVEMENT_H
6 changes: 3 additions & 3 deletions src/action.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ACTION_H
#define ACTION_H
#ifndef CATA_SRC_ACTION_H
#define CATA_SRC_ACTION_H

#include <functional>
#include <map>
Expand Down Expand Up @@ -604,4 +604,4 @@ bool can_move_vertical_at( const tripoint &p, int movez );
*/
bool can_examine_at( const tripoint &p );

#endif
#endif // CATA_SRC_ACTION_H
6 changes: 3 additions & 3 deletions src/active_item_cache.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ACTIVE_ITEM_CACHE_H
#define ACTIVE_ITEM_CACHE_H
#ifndef CATA_SRC_ACTIVE_ITEM_CACHE_H
#define CATA_SRC_ACTIVE_ITEM_CACHE_H

#include <iosfwd>
#include <list>
Expand Down Expand Up @@ -84,4 +84,4 @@ class active_item_cache
void rotate_locations( int turns, const point &dim );
};

#endif
#endif // CATA_SRC_ACTIVE_ITEM_CACHE_H
6 changes: 3 additions & 3 deletions src/activity_actor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ACTIVITY_ACTOR_H
#define ACTIVITY_ACTOR_H
#ifndef CATA_SRC_ACTIVITY_ACTOR_H
#define CATA_SRC_ACTIVITY_ACTOR_H

#include <algorithm>
#include <memory>
Expand Down Expand Up @@ -120,4 +120,4 @@ deserialize_functions;
void serialize( const cata::clone_ptr<activity_actor> &actor, JsonOut &jsout );
void deserialize( cata::clone_ptr<activity_actor> &actor, JsonIn &jsin );

#endif // ACTIVITY_ACTOR_H
#endif // CATA_SRC_ACTIVITY_ACTOR_H
6 changes: 3 additions & 3 deletions src/activity_handlers.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ACTIVITY_HANDLERS_H
#define ACTIVITY_HANDLERS_H
#ifndef CATA_SRC_ACTIVITY_HANDLERS_H
#define CATA_SRC_ACTIVITY_HANDLERS_H

#include <functional>
#include <list>
Expand Down Expand Up @@ -276,4 +276,4 @@ finish_functions;

} // namespace activity_handlers

#endif
#endif // CATA_SRC_ACTIVITY_HANDLERS_H
6 changes: 3 additions & 3 deletions src/activity_type.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ACTIVITY_TYPE_H
#define ACTIVITY_TYPE_H
#ifndef CATA_SRC_ACTIVITY_TYPE_H
#define CATA_SRC_ACTIVITY_TYPE_H

#include <string>

Expand Down Expand Up @@ -85,4 +85,4 @@ class activity_type
static void reset();
};

#endif
#endif // CATA_SRC_ACTIVITY_TYPE_H
6 changes: 3 additions & 3 deletions src/addiction.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ADDICTION_H
#define ADDICTION_H
#ifndef CATA_SRC_ADDICTION_H
#define CATA_SRC_ADDICTION_H

#include <string>

Expand Down Expand Up @@ -29,4 +29,4 @@ add_type addiction_type( const std::string &name );

std::string addiction_text( const addiction &cur );

#endif
#endif // CATA_SRC_ADDICTION_H
6 changes: 3 additions & 3 deletions src/advanced_inv.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ADVANCED_INV_H
#define ADVANCED_INV_H
#ifndef CATA_SRC_ADVANCED_INV_H
#define CATA_SRC_ADVANCED_INV_H

#include <array>
#include <cctype>
Expand Down Expand Up @@ -197,4 +197,4 @@ class advanced_inventory
const std::string &action, int &amount );
};

#endif
#endif // CATA_SRC_ADVANCED_INV_H
6 changes: 3 additions & 3 deletions src/advanced_inv_area.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ADVANCED_INV_AREA_H
#define ADVANCED_INV_AREA_H
#ifndef CATA_SRC_ADVANCED_INV_AREA_H
#define CATA_SRC_ADVANCED_INV_AREA_H

#include "point.h"
#include "units.h"
Expand Down Expand Up @@ -108,4 +108,4 @@ class advanced_inv_area
return veh != nullptr && vstor >= 0;
}
};
#endif
#endif // CATA_SRC_ADVANCED_INV_AREA_H
6 changes: 3 additions & 3 deletions src/advanced_inv_listitem.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ADVANCED_INV_LISTITEM_H
#define ADVANCED_INV_LISTITEM_H
#ifndef CATA_SRC_ADVANCED_INV_LISTITEM_H
#define CATA_SRC_ADVANCED_INV_LISTITEM_H

#include <list>
#include <string>
Expand Down Expand Up @@ -104,4 +104,4 @@ class advanced_inv_listitem
advanced_inv_listitem( const std::list<item *> &list, int index,
aim_location area, bool from_vehicle );
};
#endif
#endif // CATA_SRC_ADVANCED_INV_LISTITEM_H
6 changes: 3 additions & 3 deletions src/advanced_inv_pane.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ADVANCED_INV_PANE_H
#define ADVANCED_INV_PANE_H
#ifndef CATA_SRC_ADVANCED_INV_PANE_H
#define CATA_SRC_ADVANCED_INV_PANE_H

#include <array>
#include <cstddef>
Expand Down Expand Up @@ -133,4 +133,4 @@ class advanced_inventory_pane

mutable std::map<std::string, std::function<bool( const item & )>> filtercache;
};
#endif
#endif // CATA_SRC_ADVANCED_INV_PANE_H
6 changes: 3 additions & 3 deletions src/ammo.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef AMMO_H
#define AMMO_H
#ifndef CATA_SRC_AMMO_H
#define CATA_SRC_AMMO_H

#include <string>
#include <utility>
Expand Down Expand Up @@ -31,4 +31,4 @@ class ammunition_type
static void check_consistency();
};

#endif
#endif // CATA_SRC_AMMO_H
6 changes: 3 additions & 3 deletions src/ammo_effect.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef AMMO_EFFECT_H
#define AMMO_EFFECT_H
#ifndef CATA_SRC_AMMO_EFFECT_H
#define CATA_SRC_AMMO_EFFECT_H

#include <cstddef>
#include <string>
Expand Down Expand Up @@ -67,4 +67,4 @@ const std::vector<ammo_effect> &get_all();

extern ammo_effect_id AE_NULL;

#endif
#endif // CATA_SRC_AMMO_EFFECT_H
6 changes: 3 additions & 3 deletions src/anatomy.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ANATOMY_H
#define ANATOMY_H
#ifndef CATA_SRC_ANATOMY_H
#define CATA_SRC_ANATOMY_H

#include <algorithm>
#include <string>
Expand Down Expand Up @@ -59,4 +59,4 @@ class anatomy

extern anatomy_id human_anatomy;

#endif
#endif // CATA_SRC_ANATOMY_H
6 changes: 3 additions & 3 deletions src/animation.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ANIMATION_H
#define ANIMATION_H
#ifndef CATA_SRC_ANIMATION_H
#define CATA_SRC_ANIMATION_H

#include "color.h"

Expand Down Expand Up @@ -31,4 +31,4 @@ struct explosion_tile {
nc_color color;
};

#endif
#endif // CATA_SRC_ANIMATION_H
6 changes: 3 additions & 3 deletions src/artifact.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ARTIFACT_H
#define ARTIFACT_H
#ifndef CATA_SRC_ARTIFACT_H
#define CATA_SRC_ARTIFACT_H

#include <string>

Expand Down Expand Up @@ -132,4 +132,4 @@ bool save_artifacts( const std::string &path );

bool check_art_charge_req( item &it );

#endif
#endif // CATA_SRC_ARTIFACT_H
6 changes: 3 additions & 3 deletions src/assign.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef ASSIGN_H
#define ASSIGN_H
#ifndef CATA_SRC_ASSIGN_H
#define CATA_SRC_ASSIGN_H

#include <algorithm>
#include <map>
Expand Down Expand Up @@ -871,4 +871,4 @@ inline bool assign( const JsonObject &jo, const std::string &name, damage_instan

return true;
}
#endif
#endif // CATA_SRC_ASSIGN_H
6 changes: 3 additions & 3 deletions src/auto_note.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef AUTO_NOTE_H
#define AUTO_NOTE_H
#ifndef CATA_SRC_AUTO_NOTE_H
#define CATA_SRC_AUTO_NOTE_H

#include <string>
#include <unordered_set>
Expand Down Expand Up @@ -88,4 +88,4 @@ class auto_note_settings

auto_notes::auto_note_settings &get_auto_notes_settings();

#endif // AUTO_NOTE_H
#endif // CATA_SRC_AUTO_NOTE_H
6 changes: 3 additions & 3 deletions src/auto_pickup.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef AUTO_PICKUP_H
#define AUTO_PICKUP_H
#ifndef CATA_SRC_AUTO_PICKUP_H
#define CATA_SRC_AUTO_PICKUP_H

#include <functional>
#include <iosfwd>
Expand Down Expand Up @@ -165,4 +165,4 @@ class npc_settings : public base_settings

auto_pickup::player_settings &get_auto_pickup();

#endif
#endif // CATA_SRC_AUTO_PICKUP_H
6 changes: 3 additions & 3 deletions src/avatar.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef AVATAR_H
#define AVATAR_H
#ifndef CATA_SRC_AVATAR_H
#define CATA_SRC_AVATAR_H

#include <cstddef>
#include <string>
Expand Down Expand Up @@ -290,4 +290,4 @@ struct points_left {
std::string to_string();
};

#endif
#endif // CATA_SRC_AVATAR_H
6 changes: 3 additions & 3 deletions src/avatar_action.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef AVATAR_ACTION_H
#define AVATAR_ACTION_H
#ifndef CATA_SRC_AVATAR_ACTION_H
#define CATA_SRC_AVATAR_ACTION_H

#include "optional.h"
#include "point.h"
Expand Down Expand Up @@ -77,4 +77,4 @@ void use_item( avatar &you, item_location &loc );
void use_item( avatar &you );
} // namespace avatar_action

#endif // !AVATAR_MOVE_H
#endif // CATA_SRC_AVATAR_ACTION_H
6 changes: 3 additions & 3 deletions src/ballistics.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef BALLISTICS_H
#define BALLISTICS_H
#ifndef CATA_SRC_BALLISTICS_H
#define CATA_SRC_BALLISTICS_H

class Creature;
class dispersion_sources;
Expand Down Expand Up @@ -34,4 +34,4 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg, const tri
const tripoint &target_arg, const dispersion_sources &dispersion,
Creature *origin = nullptr, const vehicle *in_veh = nullptr );

#endif
#endif // CATA_SRC_BALLISTICS_H
6 changes: 3 additions & 3 deletions src/basecamp.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef BASECAMP_H
#define BASECAMP_H
#ifndef CATA_SRC_BASECAMP_H
#define CATA_SRC_BASECAMP_H

#include <cstddef>
#include <list>
Expand Down Expand Up @@ -380,4 +380,4 @@ class basecamp_action_components
std::unique_ptr<tinymap> map_; // Used for by-radio crafting
};

#endif
#endif // CATA_SRC_BASECAMP_H
6 changes: 3 additions & 3 deletions src/behavior.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef BEHAVIOR_H
#define BEHAVIOR_H
#ifndef CATA_SRC_BEHAVIOR_H
#define CATA_SRC_BEHAVIOR_H

#include <functional>
#include <string>
Expand Down Expand Up @@ -90,4 +90,4 @@ void check_consistency();

} // namespace behavior

#endif
#endif // CATA_SRC_BEHAVIOR_H
Loading

0 comments on commit 32e6aab

Please sign in to comment.