Skip to content

Commit b39d565

Browse files
jbowlermrbean-bremen
authored andcommitted
generator: remove anonymous structs (#121)
This is a minimal change to give the three anonymous structs used in the generator names so that the code conforms to the existing C++ standards.
1 parent 9404b9a commit b39d565

File tree

7 files changed

+62
-62
lines changed

7 files changed

+62
-62
lines changed

generator/parser/codemodel.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -683,63 +683,63 @@ void _FunctionModelItem::setException(const QString &exception)
683683

684684
bool _FunctionModelItem::isVariadics() const
685685
{
686-
return _M_isVariadics;
686+
return _M.isVariadics;
687687
}
688688

689689
void _FunctionModelItem::setVariadics(bool isVariadics)
690690
{
691-
_M_isVariadics = isVariadics;
691+
_M.isVariadics = isVariadics;
692692
}
693693

694694
bool _FunctionModelItem::isVirtual() const
695695
{
696-
return _M_isVirtual;
696+
return _M.isVirtual;
697697
}
698698

699699
void _FunctionModelItem::setVirtual(bool isVirtual)
700700
{
701-
_M_isVirtual = isVirtual;
701+
_M.isVirtual = isVirtual;
702702
}
703703

704704
bool _FunctionModelItem::isInline() const
705705
{
706-
return _M_isInline;
706+
return _M.isInline;
707707
}
708708

709709
void _FunctionModelItem::setInline(bool isInline)
710710
{
711-
_M_isInline = isInline;
711+
_M.isInline = isInline;
712712
}
713713

714714
bool _FunctionModelItem::isExplicit() const
715715
{
716-
return _M_isExplicit;
716+
return _M.isExplicit;
717717
}
718718

719719
void _FunctionModelItem::setExplicit(bool isExplicit)
720720
{
721-
_M_isExplicit = isExplicit;
721+
_M.isExplicit = isExplicit;
722722
}
723723

724724
bool _FunctionModelItem::isAbstract() const
725725
{
726-
return _M_isAbstract;
726+
return _M.isAbstract;
727727
}
728728

729729
void _FunctionModelItem::setAbstract(bool isAbstract)
730730
{
731-
_M_isAbstract = isAbstract;
731+
_M.isAbstract = isAbstract;
732732
}
733733

734734
// Qt
735735
bool _FunctionModelItem::isInvokable() const
736736
{
737-
return _M_isInvokable;
737+
return _M.isInvokable;
738738
}
739739

740740
void _FunctionModelItem::setInvokable(bool isInvokable)
741741
{
742-
_M_isInvokable = isInvokable;
742+
_M.isInvokable = isInvokable;
743743
}
744744

745745
// ---------------------------------------------------------------------------
@@ -907,92 +907,92 @@ void _MemberModelItem::setAccessPolicy(CodeModel::AccessPolicy accessPolicy)
907907

908908
bool _MemberModelItem::isStatic() const
909909
{
910-
return _M_isStatic;
910+
return _M.isStatic;
911911
}
912912

913913
void _MemberModelItem::setStatic(bool isStatic)
914914
{
915-
_M_isStatic = isStatic;
915+
_M.isStatic = isStatic;
916916
}
917917

918918
bool _MemberModelItem::isConstant() const
919919
{
920-
return _M_isConstant;
920+
return _M.isConstant;
921921
}
922922

923923
void _MemberModelItem::setConstant(bool isConstant)
924924
{
925-
_M_isConstant = isConstant;
925+
_M.isConstant = isConstant;
926926
}
927927

928928
bool _MemberModelItem::isConstexpr() const
929929
{
930-
return _M_isConstexpr;
930+
return _M.isConstexpr;
931931
}
932932

933933
void _MemberModelItem::setConstexpr(bool isConstexpr)
934934
{
935-
_M_isConstexpr = isConstexpr;
935+
_M.isConstexpr = isConstexpr;
936936
}
937937

938938
bool _MemberModelItem::isVolatile() const
939939
{
940-
return _M_isVolatile;
940+
return _M.isVolatile;
941941
}
942942

943943
void _MemberModelItem::setVolatile(bool isVolatile)
944944
{
945-
_M_isVolatile = isVolatile;
945+
_M.isVolatile = isVolatile;
946946
}
947947

948948
bool _MemberModelItem::isAuto() const
949949
{
950-
return _M_isAuto;
950+
return _M.isAuto;
951951
}
952952

953953
void _MemberModelItem::setAuto(bool isAuto)
954954
{
955-
_M_isAuto = isAuto;
955+
_M.isAuto = isAuto;
956956
}
957957

958958
bool _MemberModelItem::isFriend() const
959959
{
960-
return _M_isFriend;
960+
return _M.isFriend;
961961
}
962962

963963
void _MemberModelItem::setFriend(bool isFriend)
964964
{
965-
_M_isFriend = isFriend;
965+
_M.isFriend = isFriend;
966966
}
967967

968968
bool _MemberModelItem::isRegister() const
969969
{
970-
return _M_isRegister;
970+
return _M.isRegister;
971971
}
972972

973973
void _MemberModelItem::setRegister(bool isRegister)
974974
{
975-
_M_isRegister = isRegister;
975+
_M.isRegister = isRegister;
976976
}
977977

978978
bool _MemberModelItem::isExtern() const
979979
{
980-
return _M_isExtern;
980+
return _M.isExtern;
981981
}
982982

983983
void _MemberModelItem::setExtern(bool isExtern)
984984
{
985-
_M_isExtern = isExtern;
985+
_M.isExtern = isExtern;
986986
}
987987

988988
bool _MemberModelItem::isMutable() const
989989
{
990-
return _M_isMutable;
990+
return _M.isMutable;
991991
}
992992

993993
void _MemberModelItem::setMutable(bool isMutable)
994994
{
995-
_M_isMutable = isMutable;
995+
_M.isMutable = isMutable;
996996
}
997997

998998
// kate: space-indent on; indent-width 2; replace-tabs on;

generator/parser/codemodel.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -517,16 +517,16 @@ class _MemberModelItem: public _CodeModelItem
517517
{
518518
struct
519519
{
520-
uint _M_isConstant: 1;
521-
uint _M_isConstexpr: 1;
522-
uint _M_isVolatile: 1;
523-
uint _M_isStatic: 1;
524-
uint _M_isAuto: 1;
525-
uint _M_isFriend: 1;
526-
uint _M_isRegister: 1;
527-
uint _M_isExtern: 1;
528-
uint _M_isMutable: 1;
529-
};
520+
uint isConstant: 1;
521+
uint isConstexpr: 1;
522+
uint isVolatile: 1;
523+
uint isStatic: 1;
524+
uint isAuto: 1;
525+
uint isFriend: 1;
526+
uint isRegister: 1;
527+
uint isExtern: 1;
528+
uint isMutable: 1;
529+
} _M;
530530
uint _M_flags;
531531
};
532532

@@ -586,13 +586,13 @@ class _FunctionModelItem: public _MemberModelItem
586586
{
587587
struct
588588
{
589-
uint _M_isVirtual: 1;
590-
uint _M_isInline: 1;
591-
uint _M_isAbstract: 1;
592-
uint _M_isExplicit: 1;
593-
uint _M_isVariadics: 1;
594-
uint _M_isInvokable : 1; // Qt
595-
};
589+
uint isVirtual: 1;
590+
uint isInline: 1;
591+
uint isAbstract: 1;
592+
uint isExplicit: 1;
593+
uint isVariadics: 1;
594+
uint isInvokable : 1; // Qt
595+
} _M;
596596
uint _M_flags;
597597
};
598598

generator/parser/rpp/pp-engine-bits.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ InputIterator pp::handle_define (InputIterator _first, InputIterator _last)
577577

578578
if (_first != _last && *_first == '(')
579579
{
580-
macro.function_like = true;
580+
macro.is.function_like = true;
581581
macro.formals.reserve (5);
582582

583583
_first = skip_blanks (++_first, _last); // skip '('
@@ -589,7 +589,7 @@ InputIterator pp::handle_define (InputIterator _first, InputIterator _last)
589589

590590
if (*_first == '.')
591591
{
592-
macro.variadics = true;
592+
macro.is.variadics = true;
593593
while (*_first == '.')
594594
++_first;
595595
}
@@ -606,7 +606,7 @@ InputIterator pp::handle_define (InputIterator _first, InputIterator _last)
606606

607607
if (*_first == '.')
608608
{
609-
macro.variadics = true;
609+
macro.is.variadics = true;
610610
while (*_first == '.')
611611
++_first;
612612
}

generator/parser/rpp/pp-environment.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class pp_environment
8989
inline void unbind (pp_fast_string const *_name)
9090
{
9191
if (pp_macro *m = resolve (_name))
92-
m->hidden = true;
92+
m->is.hidden = true;
9393
}
9494

9595
inline void unbind (char const *_s, std::size_t _size)
@@ -103,7 +103,7 @@ class pp_environment
103103
std::size_t h = hash_code (*_name) % _M_hash_size;
104104
pp_macro *it = _M_base [h];
105105

106-
while (it && it->name && it->hash_code == h && (*it->name != *_name || it->hidden))
106+
while (it && it->name && it->hash_code == h && (*it->name != *_name || it->is.hidden))
107107
it = it->next;
108108

109109
return it;

generator/parser/rpp/pp-macro-expander.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class pp_macro_expander
250250
static bool hide_next = false; // ### remove me
251251

252252
pp_macro *macro = env.resolve (name_buffer, name_size);
253-
if (! macro || macro->hidden || hide_next)
253+
if (! macro || macro->is.hidden || hide_next)
254254
{
255255
hide_next = ! strcmp (name_buffer, "defined");
256256

@@ -278,13 +278,13 @@ class pp_macro_expander
278278
continue;
279279
}
280280

281-
if (! macro->function_like)
281+
if (! macro->is.function_like)
282282
{
283283
pp_macro *m = 0;
284284

285285
if (macro->definition)
286286
{
287-
macro->hidden = true;
287+
macro->is.hidden = true;
288288

289289
std::string tmp;
290290
tmp.reserve (256);
@@ -316,7 +316,7 @@ class pp_macro_expander
316316
std::copy (tmp.begin (), tmp.end (), _result);
317317
}
318318

319-
macro->hidden = false;
319+
macro->is.hidden = false;
320320
}
321321

322322
if (! m)
@@ -370,15 +370,15 @@ class pp_macro_expander
370370
_first = arg_it;
371371

372372
#if 0 // ### enable me
373-
assert ((macro->variadics && macro->formals.size () >= actuals.size ())
373+
assert ((macro->is.variadics && macro->formals.size () >= actuals.size ())
374374
|| macro->formals.size() == actuals.size());
375375
#endif
376376

377377
pp_frame frame (macro, &actuals);
378378
pp_macro_expander expand_macro (env, &frame);
379-
macro->hidden = true;
379+
macro->is.hidden = true;
380380
expand_macro (macro->definition->begin (), macro->definition->end (), _result);
381-
macro->hidden = false;
381+
macro->is.hidden = false;
382382
generated_lines += expand_macro.lines;
383383
}
384384
else
@@ -394,7 +394,7 @@ class pp_macro_expander
394394
{
395395
InputIterator arg_end = skip_argument (_first, _last);
396396

397-
while (_macro->variadics && _first != arg_end && arg_end != _last && *arg_end == ','
397+
while (_macro->is.variadics && _first != arg_end && arg_end != _last && *arg_end == ','
398398
&& (_actuals.size () + 1) == _macro->formals.size ())
399399
{
400400
arg_end = skip_argument (++arg_end, _last);

generator/parser/rpp/pp-macro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct pp_macro
6262
int unsigned hidden: 1;
6363
int unsigned function_like: 1;
6464
int unsigned variadics: 1;
65-
};
65+
} is;
6666
};
6767

6868
int lines;

generator/parser/rpp/preprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ QList<Preprocessor::MacroItem> Preprocessor::macros() const
143143
item.parameters += QString::fromLatin1(m->formals[i]->begin(),
144144
m->formals[i]->size());
145145
}
146-
item.isFunctionLike = m->function_like;
146+
item.isFunctionLike = m->is.function_like;
147147

148148
#ifdef PP_WITH_MACRO_POSITION
149149
item.fileName = QString::fromLatin1(m->file->begin(), m->file->size());

0 commit comments

Comments
 (0)