From e07ea017eadeebbc912600843bd98b019ad6029c Mon Sep 17 00:00:00 2001 From: cantor Date: Tue, 2 May 2006 03:38:09 +0000 Subject: [PATCH] Prelims for symbol hiding, doesn't work yet git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@87 de75baf8-a10c-0410-a50a-987c0e22f00f --- acinclude.m4 | 121 +++++++++++++++++++++++-------------- configure.ac | 7 +++ xmltooling/base.h | 1 + xmltooling/impl/UnknownElement.cpp | 7 +++ xmltooling/impl/UnknownElement.h | 6 +- 5 files changed, 92 insertions(+), 50 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index f758e35..15cc47f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,46 +1,75 @@ -dnl @synopsis AC_CXX_NAMESPACES -dnl -dnl If the compiler can prevent names clashes using namespaces, define -dnl HAVE_NAMESPACES. -dnl -dnl @author Luc Maisonobe -dnl -AC_DEFUN([AC_CXX_NAMESPACES], -[AC_CACHE_CHECK(whether the compiler implements namespaces, -ac_cv_cxx_namespaces, -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], - [using namespace Outer::Inner; return i;], - ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_namespaces" = yes; then - AC_DEFINE(HAVE_NAMESPACES,1,[define if the compiler implements namespaces]) -fi -]) - - -dnl -dnl @author Luc Maisonobe -dnl -AC_DEFUN([AC_CXX_REQUIRE_STL], -[AC_CACHE_CHECK(whether the compiler supports Standard Template Library, -ac_cv_cxx_have_stl, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[list x; x.push_back(5); -list::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;], - ac_cv_cxx_have_stl=yes, ac_cv_cxx_have_stl=no) - AC_LANG_RESTORE -]) -if test "x_$ac_cv_cxx_have_stl" != x_yes; then - AC_MSG_ERROR([C++ Standard Template Libary unsupported]) -fi -]) - +dnl @synopsis AC_CXX_NAMESPACES +dnl +dnl If the compiler can prevent names clashes using namespaces, define +dnl HAVE_NAMESPACES. +dnl +dnl @author Luc Maisonobe +dnl +AC_DEFUN([AC_CXX_NAMESPACES], +[AC_CACHE_CHECK(whether the compiler implements namespaces, +ac_cv_cxx_namespaces, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], + [using namespace Outer::Inner; return i;], + ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_namespaces" = yes; then + AC_DEFINE(HAVE_NAMESPACES,1,[define if the compiler implements namespaces]) +fi +]) + + +dnl +dnl @author Luc Maisonobe +dnl +AC_DEFUN([AC_CXX_REQUIRE_STL], +[AC_CACHE_CHECK(whether the compiler supports Standard Template Library, +ac_cv_cxx_have_stl, +[AC_REQUIRE([AC_CXX_NAMESPACES]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([#include +#include +#ifdef HAVE_NAMESPACES +using namespace std; +#endif],[list x; x.push_back(5); +list::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;], + ac_cv_cxx_have_stl=yes, ac_cv_cxx_have_stl=no) + AC_LANG_RESTORE +]) +if test "x_$ac_cv_cxx_have_stl" != x_yes; then + AC_MSG_ERROR([C++ Standard Template Libary unsupported]) +fi +]) + +dnl Determine whether we have gcc of a particular version or later, +dnl based on major, minor, patchlevel versions and date. +dnl AC_HAVE_GCC_VERSION(MAJOR_VERSION, MINOR_VERSION, PATCH_LEVEL, +dnl SNAPSHOT_DATE [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_HAVE_GCC_VERSION, +[AC_CACHE_CHECK([gcc is at least version $1.$2.$3.$4], + ac_cv_gcc_version_$1_$2_$3_$4, +[ + if test x$GCC = x ; then ac_cv_gcc_version_$1_$2_$3_$4=no + else + ac_gcc_date=`$CC -v 2>&1 | grep '^gcc version ' | sed 's/ (.*//; s/.* //'` + if test 0$ac_gcc_date -eq 0 ; then ac_gcc_date=0 ; fi + AC_EGREP_CPP(yes, [#define HAVE_GCC_VERSION(MAJOR, MINOR, MICRO, DATE) \ + (__GNUC__ > (MAJOR) \ + || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ > (MINOR)) \ + || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ == (MINOR) \ + && __GNUC_PATCHLEVEL__ > (MICRO)) \ + || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ == (MINOR) \ + && __GNUC_PATCHLEVEL__ == (MICRO) && ${ac_gcc_date}L >= (DATE))) +#if HAVE_GCC_VERSION($1,$2,$3,$4) +yes +#endif], + AC_DEFINE_UNQUOTED(HAVE_GCC_VERSION_$1_$2_$3_$4, 1, + [Define to 1 if we have gcc $1.$2.$3 ($4)]) + ac_cv_gcc_version_$1_$2_$3_$4=yes ; $5, + ac_cv_gcc_version_$1_$2_$3_$4=no ; $6) +fi +])])dnl + diff --git a/configure.ac b/configure.ac index 2b8ac71..bcb59f9 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,13 @@ AC_PROG_CC([gcc gcc3 cc]) AC_PROG_CXX([g++ g++3 c++ CC]) if test "$GCC" = "yes" ; then +# AC_HAVE_GCC_VERSION(4,0,0,0, +# [ +# AC_DEFINE(GCC_HASCLASSVISIBILITY,1, +# [Define to enable class visibility control in gcc.]) +# GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden" +# GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden" +# ]) CFLAGS="$GCC_CFLAGS" CXXFLAGS="$GCC_CXXFLAGS" fi diff --git a/xmltooling/base.h b/xmltooling/base.h index 87e4361..9f222a5 100644 --- a/xmltooling/base.h +++ b/xmltooling/base.h @@ -487,6 +487,7 @@ */ #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \ BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \ + XMLTOOLING_DOXYGEN(Singleton builder.) \ static cname* new##cname() { \ const cname##Builder* b = dynamic_cast( \ XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \ diff --git a/xmltooling/impl/UnknownElement.cpp b/xmltooling/impl/UnknownElement.cpp index 6759e5f..50c1954 100644 --- a/xmltooling/impl/UnknownElement.cpp +++ b/xmltooling/impl/UnknownElement.cpp @@ -186,3 +186,10 @@ XMLObject* UnknownElementImpl::unmarshall(DOMElement* element, bool bindDocument setDOM(element, bindDocument); return this; } + +XMLObject* UnknownElementBuilder::buildObject( + const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType + ) const { + return new UnknownElementImpl(nsURI,localName,prefix); +} + diff --git a/xmltooling/impl/UnknownElement.h b/xmltooling/impl/UnknownElement.h index 701bb8f..ea2aafd 100644 --- a/xmltooling/impl/UnknownElement.h +++ b/xmltooling/impl/UnknownElement.h @@ -20,7 +20,7 @@ * Basic implementation suitable for use as default for unrecognized content */ -#if !defined(__xmltooling_unkelement_h__) +#ifndef __xmltooling_unkelement_h__ #define __xmltooling_unkelement_h__ #include @@ -77,9 +77,7 @@ namespace xmltooling { public: XMLObject* buildObject( const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL - ) const { - return new UnknownElementImpl(nsURI,localName,prefix); - } + ) const; }; }; -- 2.1.4