Skip to content

Commit

Permalink
Fix things so Werror build passes all regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
highperformancecoder committed Sep 19, 2016
1 parent 5e9a963 commit a7f0eb4
Show file tree
Hide file tree
Showing 20 changed files with 381 additions and 243 deletions.
475 changes: 242 additions & 233 deletions classdesc.cc

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions java/compileClass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ std::vector<std::string> JNI_arglist(const std::string& sig)
ret.push_back("jstring");
else
ret.push_back("jobject");
while (*c!=';') ++c; break;
while (*c!=';') ++c;
break;
case '[': c++;
switch (*c)
{
Expand All @@ -71,7 +72,8 @@ std::vector<std::string> JNI_arglist(const std::string& sig)
case 'F': ret.push_back("jfloatArray"); break;
case 'D': ret.push_back("jdoubleArray"); break;
case 'L': ret.push_back("jobjectArray");
while (*c!=';') ++c; break;
while (*c!=';') ++c;
break;
}
case ')': case '(': break;
default:
Expand Down
3 changes: 2 additions & 1 deletion javaClass_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ namespace classdesc
public:
getter_setter(T& m): m(m) {}
void operator()(RetVal& r, ArgVector& args) {
if (args.size()) m=args[0].get<T>(); *r.getRef<T>()=m;
if (args.size()) m=args[0].get<T>();
*r.getRef<T>()=m;
}
};
}
Expand Down
4 changes: 4 additions & 0 deletions object.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ unpack(classdesc::unpack_t& b, const classdesc::string& d, const classdesc::shar
b>>t;
if (t)
{
#if defined(__cplusplus) && __cplusplus>=201103L
std::unique_ptr<T> a(classdesc::object::create(t-1));
#else
std::auto_ptr<T> a(classdesc::object::create(t-1));
#endif
a->unpack(b);
}
}
Expand Down
7 changes: 7 additions & 0 deletions polyAccessJsonPack.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ namespace classdesc_access
{json_unpack_smart_ptr(x,d,a);}
};

#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
template <class T>
struct access_json_pack<std::auto_ptr<T> >
{
Expand All @@ -126,6 +130,9 @@ namespace classdesc_access
std::auto_ptr<T>& a)
{json_unpack_smart_ptr(x,d,a);}
};
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#if defined(__cplusplus) && __cplusplus >= 201103L
template <class T, class D>
Expand Down
8 changes: 8 additions & 0 deletions polyAccessPack.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ namespace classdesc_access
{unpack_smart_ptr(x,d,a);}
};


#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
template <class T>
struct access_pack<std::auto_ptr<T> >
{
Expand All @@ -117,6 +122,9 @@ namespace classdesc_access
void operator()(cd::unpack_t& x, const cd::string& d, U& a)
{unpack_smart_ptr(x,d,a);}
};
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#if defined(__cplusplus) && __cplusplus >= 201103L
template <class T, class D>
Expand Down
14 changes: 14 additions & 0 deletions polyAccessXMLPack.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,17 @@ void xml_pack(classdesc::xml_pack_t& x, const classdesc::string& d,
classdesc::shared_ptr<T>& a)
{classdesc::xml_pack_smart_ptr(x,d,a);}

#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
template<class T>
void xml_pack(classdesc::xml_pack_t& x, const classdesc::string& d,
std::auto_ptr<T>& a)
{classdesc::xml_pack_smart_ptr(x,d,a);}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#if defined(__cplusplus) && __cplusplus >= 201103L
template<class T, class D>
Expand Down Expand Up @@ -115,12 +122,19 @@ namespace classdesc_access
{xml_unpack_smart_ptr(x,d,a);}
};

#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
template <class T>
struct access_xml_unpack<std::auto_ptr<T> >
{
void operator()(cd::xml_unpack_t& x, const cd::string& d, std::auto_ptr<T>& a)
{xml_unpack_smart_ptr(x,d,a);}
};
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif


#if defined(__cplusplus) && __cplusplus >= 201103L
Expand Down
6 changes: 0 additions & 6 deletions stringKeyMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ namespace classdesc
throw json_pack_error("attempt to pack an array member into a non-object");
else
{
json_spirit::mValue* v;
if (d.empty())
v=&parent;
else
v=&parent.get_obj()[tail(d)];

typename StringKeyMap<T>::const_iterator i=a.begin();
for (; i!=a.end(); ++i)
json_pack(j,d+"."+i->first, i->second);
Expand Down
8 changes: 8 additions & 0 deletions test/00/inheritedNested.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ EOF

cat >test.cd.expected <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
template <> struct access_p<struct ::FlowCounter > {
Expand All @@ -61,6 +66,9 @@ void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE
}
};
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

classdesc p <test.h >test.cd
Expand Down
8 changes: 8 additions & 0 deletions test/00/t0015a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ if test $? -ne 0; then fail; fi

cat >testout1 <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
template <> struct access_p<class ::foo > {
Expand All @@ -81,6 +86,9 @@ using namespace bar;
}
};
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

sed -e '/^$/d' testout >testout2
Expand Down
7 changes: 7 additions & 0 deletions test/00/t0016a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ EOF

cat >testout2 <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
template <> struct access_p<class ::foo > {
Expand All @@ -61,6 +65,9 @@ void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE
}
};
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

sed -e '/^$/d' <testout >testout1
Expand Down
8 changes: 8 additions & 0 deletions test/00/t0019a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ EOF

cat >output <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
template <> struct access_p<class ::foo > {
Expand All @@ -60,6 +65,9 @@ void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE
}
};
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

$here/classdesc p <input >tmp
Expand Down
24 changes: 24 additions & 0 deletions test/00/t0020a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ EOF

cat >test.cd <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
template < class T > struct access_p<struct ::x<T> > {
Expand All @@ -63,6 +68,9 @@ void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE
}
};
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

$here/classdesc p <test.cc >tmp
Expand All @@ -85,9 +93,17 @@ EOF

cat >test.cd <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

$here/classdesc p <test.cc >tmp
Expand All @@ -111,9 +127,17 @@ EOF

cat >test.cd <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

$here/classdesc p <test.cc >tmp
Expand Down
7 changes: 7 additions & 0 deletions test/00/t0021a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,16 @@ EOF

cat >test.out <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

$here/classdesc p <test.cc >tmp
Expand Down
7 changes: 7 additions & 0 deletions test/00/t0023a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ if test $? -ne 0; then fail; fi

cat >out2 <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
template <>
Expand All @@ -66,6 +70,9 @@ void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE
}
};
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

diff -B -b out1 out2
Expand Down
8 changes: 8 additions & 0 deletions test/00/t0061a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ if test $? -ne 0; then fail; fi

cat >input.cd.tmp <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
template < class T > struct access_p<struct ::foo<T> > {
Expand All @@ -63,6 +68,9 @@ void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE
}
};
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

diff -q -w input.cd input.cd.tmp
Expand Down
2 changes: 1 addition & 1 deletion test/00/t0062a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ cat >input.cc <<EOF
int main() {}
EOF

echo "compilation should fail, so if it succeeds, test should fail"
$CC -I$here -DTR1 input.cc
# compilation should fail, so if it succeeds, fail out the test
if test $? -eq 0; then fail; fi

pass
8 changes: 8 additions & 0 deletions test/00/t0065a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ EOF

cat >expected.dat <<EOF
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
template <> struct access_p<struct ::foo > {
Expand All @@ -61,6 +66,9 @@ void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE
}
};
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
EOF

$here/classdesc -onbase p <input.dat >output.dat
Expand Down
7 changes: 7 additions & 0 deletions test/test_private.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include "classdesc.h"
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#include "p_base.h"
namespace classdesc_access {
template <> struct access_p<class ::foo > {
Expand Down Expand Up @@ -26,3 +30,6 @@ void operator()(classdesc::p_t& targ, const classdesc::string& desc,_CD_ARG_TYPE
}
};
}
#if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
Loading

0 comments on commit a7f0eb4

Please sign in to comment.