Skip to content

Commit aa059c0

Browse files
Merge branch 'master' into return-restprocess-object-refactor
2 parents 7701bf3 + 030cc4d commit aa059c0

14 files changed

+89
-2
lines changed

classdesc.cc

+18-1
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,21 @@ class PrintNameSpace
10611061
~PrintNameSpace() {if (print) printf("}\n");}
10621062
};
10631063

1064+
// add a guard macro around code generated by this scope
1065+
struct GuardMacro
1066+
{
1067+
GuardMacro(string macro)
1068+
{
1069+
// replace all non-legal identifier characters with '_'.
1070+
for (unsigned i=0; i<macro.length(); ++i)
1071+
if (!isalnum(macro[i]))
1072+
macro[i]='_';
1073+
printf("\n#ifndef %s\n",macro.c_str());
1074+
printf("#define %s\n",macro.c_str());
1075+
}
1076+
~GuardMacro() {printf("#endif\n");}
1077+
};
1078+
10641079
string type_qualifier(const string& type)
10651080
{
10661081
if (leadeq(type,"class")) return "class";
@@ -1466,10 +1481,12 @@ int main(int argc, char* argv[])
14661481
}
14671482

14681483
for (size_t i=0; i<actions.size(); i++)
1469-
{ /* check if type has a #pragma associated */
1484+
{
1485+
/* check if type has a #pragma associated */
14701486
bool is_treenode, is_graphnode;
14711487
{
14721488
string n=without_type_qualifier(actions[i].type);
1489+
GuardMacro guardMacro(string("CLASSDESC_")+action[k]+"_"+n);
14731490

14741491
/* strip out template arguments, collapse multiple spaces,
14751492
remove trailing space */

test/00/baseClassTypeName.sh

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ void p_type(p_t&,const string&,M);
6464
}
6565
using classdesc::p_type;
6666
namespace classdesc_access {
67+
68+
#ifndef CLASSDESC_p___foo_N_
69+
#define CLASSDESC_p___foo_N_
70+
#endif
6771
template < class N > struct access_p< struct ::foo<N> > {
6872
template <class _CD_ARG_TYPE>
6973
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

test/00/inheritedNested.sh

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ void p_type(p_t&,const string&,M);
6464
}
6565
using classdesc::p_type;
6666
namespace classdesc_access {
67+
68+
#ifndef CLASSDESC_p___FlowCounter
69+
#define CLASSDESC_p___FlowCounter
70+
#endif
6771
template <> struct access_p< struct ::FlowCounter > {
6872
template <class _CD_ARG_TYPE>
6973
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

test/00/qt.sh

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ void p_type(p_t&,const string&,M);
6767
}
6868
using classdesc::p_type;
6969
namespace classdesc_access {
70+
71+
#ifndef CLASSDESC_p___foo
72+
#define CLASSDESC_p___foo
73+
#endif
7074
template <> struct access_p< class ::foo > {
7175
template <class _CD_ARG_TYPE>
7276
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

test/00/t0015a.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ if test $? -ne 0; then fail; fi
6464

6565
cat >testout1 <<EOF
6666
#include "classdesc.h"
67-
6867
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
6968
#pragma GCC diagnostic push
7069
#pragma GCC diagnostic ignored "-Wunused-function"
@@ -77,6 +76,9 @@ void p_type(p_t&,const string&,M);
7776
}
7877
using classdesc::p_type;
7978
namespace classdesc_access {
79+
#ifndef CLASSDESC_p___foo
80+
#define CLASSDESC_p___foo
81+
#endif
8082
template <> struct access_p< class ::foo > {
8183
template <class _CD_ARG_TYPE>
8284
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)
@@ -88,6 +90,9 @@ void type(classdesc::p_t& targ, const classdesc::string& desc)
8890
{
8991
}
9092
};
93+
#ifndef CLASSDESC_p___bar__foo
94+
#define CLASSDESC_p___bar__foo
95+
#endif
9196
template <> struct access_p< class ::bar::foo > {
9297
template <class _CD_ARG_TYPE>
9398
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

test/00/t0016a.sh

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ void p_type(p_t&,const string&,M);
6363
}
6464
using classdesc::p_type;
6565
namespace classdesc_access {
66+
#ifndef CLASSDESC_p___foo
67+
#define CLASSDESC_p___foo
68+
#endif
6669
template <> struct access_p< class ::foo > {
6770
template <class _CD_ARG_TYPE>
6871
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

test/00/t0019a.sh

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ void p_type(p_t&,const string&,M);
6363
}
6464
using classdesc::p_type;
6565
namespace classdesc_access {
66+
67+
#ifndef CLASSDESC_p___foo
68+
#define CLASSDESC_p___foo
69+
#endif
6670
template <> struct access_p< class ::foo > {
6771
template <class _CD_ARG_TYPE>
6872
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

test/00/t0020a.sh

+12
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ void p_type(p_t&,const string&,M);
6767
}
6868
using classdesc::p_type;
6969
namespace classdesc_access {
70+
71+
#ifndef CLASSDESC_p___x_T_
72+
#define CLASSDESC_p___x_T_
73+
#endif
7074
template < class T > struct access_p< struct ::x<T> > {
7175
template <class _CD_ARG_TYPE>
7276
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)
@@ -118,6 +122,10 @@ void p_type(p_t&,const string&,M);
118122
}
119123
using classdesc::p_type;
120124
namespace classdesc_access {
125+
126+
#ifndef CLASSDESC_p___x_T_
127+
#define CLASSDESC_p___x_T_
128+
#endif
121129
}
122130
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
123131
#pragma GCC diagnostic pop
@@ -158,6 +166,10 @@ void p_type(p_t&,const string&,M);
158166
}
159167
using classdesc::p_type;
160168
namespace classdesc_access {
169+
170+
#ifndef CLASSDESC_p___x_T_
171+
#define CLASSDESC_p___x_T_
172+
#endif
161173
}
162174
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
163175
#pragma GCC diagnostic pop

test/00/t0021a.sh

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ void p_type(p_t&,const string&,M);
6767
}
6868
using classdesc::p_type;
6969
namespace classdesc_access {
70+
71+
#ifndef CLASSDESC_p___member_entry__void_____
72+
#define CLASSDESC_p___member_entry__void_____
73+
#endif
7074
}
7175
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
7276
#pragma GCC diagnostic pop

test/00/t0023a.sh

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ void p_type(p_t&,const string&,M);
6262
}
6363
using classdesc::p_type;
6464
namespace classdesc_access {
65+
66+
#ifndef CLASSDESC_p___foo
67+
#define CLASSDESC_p___foo
68+
#endif
6569
template <>
6670
struct access_p< class ::foo* >
6771
{

test/00/t0061a.sh

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ void p_type(p_t&,const string&,M);
6767
}
6868
using classdesc::p_type;
6969
namespace classdesc_access {
70+
71+
#ifndef CLASSDESC_p___foo_T_
72+
#define CLASSDESC_p___foo_T_
73+
#endif
7074
template < class T > struct access_p< struct ::foo<T> > {
7175
template <class _CD_ARG_TYPE>
7276
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

test/00/t0065a.sh

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ void p_type(p_t&,const string&,M);
6363
}
6464
using classdesc::p_type;
6565
namespace classdesc_access {
66+
67+
#ifndef CLASSDESC_p___foo
68+
#define CLASSDESC_p___foo
69+
#endif
6670
template <> struct access_p< struct ::foo > {
6771
template <class _CD_ARG_TYPE>
6872
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

test/test_private.out

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ void p_type(p_t&,const string&,M);
1111
}
1212
using classdesc::p_type;
1313
namespace classdesc_access {
14+
#ifndef CLASSDESC_p___foo
15+
#define CLASSDESC_p___foo
16+
#endif
1417
template <> struct access_p< class ::foo > {
1518
template <class _CD_ARG_TYPE>
1619
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)
@@ -24,6 +27,9 @@ void type(classdesc::p_t& targ, const classdesc::string& desc)
2427
{
2528
}
2629
};
30+
#ifndef CLASSDESC_p___bar
31+
#define CLASSDESC_p___bar
32+
#endif
2733
template <> struct access_p< struct ::bar > {
2834
template <class _CD_ARG_TYPE>
2935
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)
@@ -35,6 +41,9 @@ void type(classdesc::p_t& targ, const classdesc::string& desc)
3541
{
3642
}
3743
};
44+
#ifndef CLASSDESC_p_bamboo
45+
#define CLASSDESC_p_bamboo
46+
#endif
3847
template <> struct access_p< bamboo > {
3948
template <class _CD_ARG_TYPE>
4049
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

test/test_private.private.out

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ void p_type(p_t&,const string&,M);
1111
}
1212
using classdesc::p_type;
1313
namespace classdesc_access {
14+
#ifndef CLASSDESC_p___foo
15+
#define CLASSDESC_p___foo
16+
#endif
1417
template <> struct access_p< class ::foo > {
1518
template <class _CD_ARG_TYPE>
1619
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)
@@ -22,6 +25,9 @@ void type(classdesc::p_t& targ, const classdesc::string& desc)
2225
{
2326
}
2427
};
28+
#ifndef CLASSDESC_p___bar
29+
#define CLASSDESC_p___bar
30+
#endif
2531
template <> struct access_p< struct ::bar > {
2632
template <class _CD_ARG_TYPE>
2733
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)
@@ -33,6 +39,9 @@ void type(classdesc::p_t& targ, const classdesc::string& desc)
3339
{
3440
}
3541
};
42+
#ifndef CLASSDESC_p_bamboo
43+
#define CLASSDESC_p_bamboo
44+
#endif
3645
template <> struct access_p< bamboo > {
3746
template <class _CD_ARG_TYPE>
3847
void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE& arg)

0 commit comments

Comments
 (0)