Skip to content
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
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Checks: >
-readability-use-concise-preprocessor-directives,
-readability-uppercase-literal-suffix,
-performance-avoid-endl,
-performance-enum-size,
-performance-inefficient-string-concatenation,
-performance-no-automatic-move,
-performance-noexcept-move-constructor
Expand Down
3 changes: 2 additions & 1 deletion simplecpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <cctype>
#include <climits>
#include <cstddef> // IWYU pragma: keep
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
Expand Down Expand Up @@ -3366,7 +3367,7 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
// True => code in current #if block should be kept
// ElseIsTrue => code in current #if block should be dropped. the code in the #else should be kept.
// AlwaysFalse => drop all code in #if and #else
enum IfState { True, ElseIsTrue, AlwaysFalse };
enum IfState : std::uint8_t { True, ElseIsTrue, AlwaysFalse };
std::stack<int> ifstates;
std::stack<const Token *> iftokens;
ifstates.push(True);
Expand Down
11 changes: 5 additions & 6 deletions simplecpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define simplecppH

#include <cctype>
#include <cstdint>
#include <cstring>
#include <iosfwd>
#include <list>
Expand Down Expand Up @@ -39,9 +40,7 @@
# define SIMPLECPP_LIB
#endif

#ifdef _WIN32
# include <cstdint>
#else
#ifndef _WIN32
# include <sys/stat.h>
#endif

Expand All @@ -63,10 +62,10 @@

namespace simplecpp {
/** C code standard */
enum cstd_t { CUnknown=-1, C89, C99, C11, C17, C23, C2Y };
enum cstd_t : std::int8_t { CUnknown=-1, C89, C99, C11, C17, C23, C2Y };

/** C++ code standard */
enum cppstd_t { CPPUnknown=-1, CPP03, CPP11, CPP14, CPP17, CPP20, CPP23, CPP26 };
enum cppstd_t : std::int8_t { CPPUnknown=-1, CPP03, CPP11, CPP14, CPP17, CPP20, CPP23, CPP26 };

using TokenString = std::string;
class Macro;
Expand Down Expand Up @@ -204,7 +203,7 @@ namespace simplecpp {
/** Output from preprocessor */
struct SIMPLECPP_LIB Output {
explicit Output(const std::vector<std::string> &files) : type(ERROR), location(files) {}
enum Type {
enum Type : std::uint8_t {
ERROR, /* #error */
WARNING, /* #warning */
MISSING_HEADER,
Expand Down