reduced padding in some classes/structs (#4295)

This commit is contained in:
Oliver Stöneberg 2022-07-24 10:17:11 +02:00 committed by GitHub
parent 8a674e110a
commit b2f15fdbb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 32 deletions

View File

@ -12,7 +12,7 @@ target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/simp
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
# false positive warning in up to Clang 13 - caused by FD_ZERO macro
set_source_files_properties(threadexecutor.cpp PROPERTIES COMPILE_FLAGS -Wno-reserved-identifier)
set_source_files_properties(processexecutor.cpp PROPERTIES COMPILE_FLAGS -Wno-reserved-identifier)
endif()
list(APPEND cppcheck_SOURCES ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)

View File

@ -2303,11 +2303,11 @@ Function::Function(const Tokenizer *mTokenizer,
nestedIn(scope),
initArgCount(0),
type(eFunction),
access(AccessControl::Public),
noexceptArg(nullptr),
throwArg(nullptr),
templateDef(nullptr),
functionPointerUsage(nullptr),
access(AccessControl::Public),
mFlags(0)
{
// operator function
@ -2423,11 +2423,11 @@ Function::Function(const Token *tokenDef, const std::string &clangType)
nestedIn(nullptr),
initArgCount(0),
type(eFunction),
access(AccessControl::Public),
noexceptArg(nullptr),
throwArg(nullptr),
templateDef(nullptr),
functionPointerUsage(nullptr),
access(AccessControl::Public),
mFlags(0)
{
// operator function

View File

@ -918,11 +918,11 @@ public:
std::list<Variable> argumentList; ///< argument list
nonneg int initArgCount; ///< number of args with default values
Type type; ///< constructor, destructor, ...
AccessControl access; ///< public/protected/private
const Token *noexceptArg; ///< noexcept token
const Token *throwArg; ///< throw token
const Token *templateDef; ///< points to 'template <' before function
const Token *functionPointerUsage; ///< function pointer usage
AccessControl access; ///< public/protected/private
bool argsMatch(const Scope *scope, const Token *first, const Token *second, const std::string &path, nonneg int path_length) const;

View File

@ -74,6 +74,20 @@ struct TokenImpl {
nonneg int mColumn;
nonneg int mExprId;
/**
* A value from 0-100 that provides a rough idea about where in the token
* list this token is located.
*/
nonneg int mProgressValue;
/**
* Token index. Position in token list
*/
nonneg int mIndex;
/** Bitfield bit count. */
unsigned char mBits;
// AST..
Token *mAstOperand1;
Token *mAstOperand2;
@ -88,17 +102,6 @@ struct TokenImpl {
const Enumerator *mEnumerator;
};
/**
* A value from 0-100 that provides a rough idea about where in the token
* list this token is located.
*/
nonneg int mProgressValue;
/**
* Token index. Position in token list
*/
nonneg int mIndex;
// original name like size_t
std::string* mOriginalName;
@ -126,9 +129,6 @@ struct TokenImpl {
// For memoization, to speed up parsing of huge arrays #8897
enum class Cpp11init {UNKNOWN, CPP11INIT, NOINIT} mCpp11init;
/** Bitfield bit count. */
unsigned char mBits;
TokenDebug mDebug;
void setCppcheckAttribute(CppcheckAttributes::Type type, MathLib::bigint value);
@ -140,14 +140,14 @@ struct TokenImpl {
mLineNumber(0),
mColumn(0),
mExprId(0),
mProgressValue(0),
mIndex(0),
mBits(0),
mAstOperand1(nullptr),
mAstOperand2(nullptr),
mAstParent(nullptr),
mScope(nullptr),
mFunction(nullptr) // Initialize whole union
,
mProgressValue(0),
mIndex(0),
mFunction(nullptr), // Initialize whole union
mOriginalName(nullptr),
mValueType(nullptr),
mValues(nullptr),
@ -155,7 +155,6 @@ struct TokenImpl {
mScopeInfo(nullptr),
mCppcheckAttributes(nullptr),
mCpp11init(Cpp11init::UNKNOWN),
mBits(0),
mDebug(TokenDebug::None)
{}

View File

@ -8525,7 +8525,6 @@ ValueFlow::Value::Value(const Token* c, long long val, Bound b)
intvalue(val),
tokvalue(nullptr),
floatValue(0.0),
moveKind(MoveKind::NonMovedVariable),
varvalue(val),
condition(c),
varId(0),
@ -8534,6 +8533,7 @@ ValueFlow::Value::Value(const Token* c, long long val, Bound b)
macro(false),
defaultArg(false),
indirect(0),
moveKind(MoveKind::NonMovedVariable),
path(0),
wideintvalue(0),
subexpressions(),

View File

@ -93,7 +93,6 @@ namespace ValueFlow {
intvalue(val),
tokvalue(nullptr),
floatValue(0.0),
moveKind(MoveKind::NonMovedVariable),
varvalue(val),
condition(nullptr),
varId(0U),
@ -102,6 +101,7 @@ namespace ValueFlow {
macro(false),
defaultArg(false),
indirect(0),
moveKind(MoveKind::NonMovedVariable),
path(0),
wideintvalue(val),
subexpressions(),
@ -331,9 +331,6 @@ namespace ValueFlow {
/** float value */
double floatValue;
/** kind of moved */
enum class MoveKind {NonMovedVariable, MovedVariable, ForwardedVariable} moveKind;
/** For calculated values - variable value that calculated value depends on */
long long varvalue;
@ -361,6 +358,9 @@ namespace ValueFlow {
int indirect;
/** kind of moved */
enum class MoveKind {NonMovedVariable, MovedVariable, ForwardedVariable} moveKind;
/** Path id */
MathLib::bigint path;
@ -472,18 +472,18 @@ bool isContainerSizeChanged(const Token* tok, const Settings* settings = nullptr
struct LifetimeToken {
const Token* token;
bool addressOf;
ValueFlow::Value::ErrorPath errorPath;
bool addressOf;
bool inconclusive;
LifetimeToken() : token(nullptr), addressOf(false), errorPath(), inconclusive(false) {}
LifetimeToken() : token(nullptr), errorPath(), addressOf(false), inconclusive(false) {}
LifetimeToken(const Token* token, ValueFlow::Value::ErrorPath errorPath)
: token(token), addressOf(false), errorPath(std::move(errorPath)), inconclusive(false)
: token(token), errorPath(std::move(errorPath)), addressOf(false), inconclusive(false)
{}
LifetimeToken(const Token* token, bool addressOf, ValueFlow::Value::ErrorPath errorPath)
: token(token), addressOf(addressOf), errorPath(std::move(errorPath)), inconclusive(false)
: token(token), errorPath(std::move(errorPath)), addressOf(addressOf), inconclusive(false)
{}
static std::vector<LifetimeToken> setAddressOf(std::vector<LifetimeToken> v, bool b) {