From bf5ca79e85ab036169c4aa3a1fed569fe7e63909 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 23 Aug 2018 22:49:33 +0900 Subject: Fixed typedef-related warnings from compiler. Signed-off-by: Michele Calgaro --- lib/cppparser/ast.h | 192 +++++++++++++++------------------------------------- 1 file changed, 53 insertions(+), 139 deletions(-) diff --git a/lib/cppparser/ast.h b/lib/cppparser/ast.h index 4c71855a..a55325bd 100644 --- a/lib/cppparser/ast.h +++ b/lib/cppparser/ast.h @@ -26,92 +26,6 @@ #include #include -#if defined( Q_OS_WIN32 ) || defined( TQ_CC_SUN ) - -#ifndef _THROW0 -# define _THROW0() -#endif - -template class AUTO_PTR { -private: - _Tp* _M_ptr; - -public: - typedef _Tp element_type; - - explicit AUTO_PTR(_Tp* __p = 0) _THROW0() : _M_ptr(__p) {} - - template AUTO_PTR(AUTO_PTR<_Tp1>& __a) _THROW0() - : _M_ptr(__a.release()) {} - - AUTO_PTR(AUTO_PTR& __a) _THROW0() : _M_ptr(__a.release()) {} - - - - template - AUTO_PTR& operator=(AUTO_PTR<_Tp1>& __a) _THROW0() { - if (__a.get() != this->get()) { - delete _M_ptr; - _M_ptr = __a.release(); - } - return *this; - } - - AUTO_PTR& operator=(AUTO_PTR& __a) _THROW0() { - if (&__a != this) { - delete _M_ptr; - _M_ptr = __a.release(); - } - return *this; - } - - ~AUTO_PTR() _THROW0() { delete _M_ptr; } - - _Tp& operator*() const _THROW0() { - return *_M_ptr; - } - _Tp* operator->() const _THROW0() { - return _M_ptr; - } - _Tp* get() const _THROW0() { - return _M_ptr; - } - _Tp* release() _THROW0() { - _Tp* __tmp = _M_ptr; - _M_ptr = 0; - return __tmp; - } - void reset(_Tp* __p = 0) _THROW0() { - delete _M_ptr; - _M_ptr = __p; - } - - // According to the C++ standard, these conversions are required. Most - // present-day compilers, however, do not enforce that requirement---and, - // in fact, most present-day compilers do not support the language - // features that these conversions rely on. - - -private: - template struct AUTO_PTR_ref { - _Tp1* _M_ptr; - AUTO_PTR_ref(_Tp1* __p) : _M_ptr(__p) {} - }; - -public: - AUTO_PTR(AUTO_PTR_ref<_Tp> __ref) _THROW0() - : _M_ptr(__ref._M_ptr) {} - template operator AUTO_PTR_ref<_Tp1>() _THROW0() - { return AUTO_PTR_ref<_Tp>(this->release()); } - template operator AUTO_PTR<_Tp1>() _THROW0() - { return AUTO_PTR<_Tp1>(this->release()) } - -}; - -#else -#define AUTO_PTR std::auto_ptr -#endif - template typename T::Node CreateNode() { typename T::Node node( new T ); @@ -241,7 +155,7 @@ class CommentAST { class AST : public CommentAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type=NodeType_Generic }; DECLARE_ALLOC( AST ) @@ -303,7 +217,7 @@ private: class GroupAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Group }; DECLARE_ALLOC( GroupAST ) @@ -328,7 +242,7 @@ private: class TemplateArgumentListAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_TemplateArgumentList }; DECLARE_ALLOC( TemplateArgumentListAST ) @@ -352,7 +266,7 @@ private: class ClassOrNamespaceNameAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_ClassOrNamespaceName }; DECLARE_ALLOC( ClassOrNamespaceNameAST ) @@ -380,7 +294,7 @@ private: class NameAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Name }; DECLARE_ALLOC( NameAST ) @@ -412,7 +326,7 @@ private: class TypeParameterAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_TypeParameter }; DECLARE_ALLOC( TypeParameterAST ) @@ -424,7 +338,7 @@ public: void setKind( AST::Node& kind ); class TemplateParameterListAST* templateParameterList() { return m_templateParameterList.get(); } - void setTemplateParameterList( AUTO_PTR& templateParameterList ); + void setTemplateParameterList( std::auto_ptr& templateParameterList ); NameAST* name() { return m_name.get(); } void setName( NameAST::Node& name ); @@ -434,7 +348,7 @@ public: private: AST::Node m_kind; - AUTO_PTR m_templateParameterList; + std::auto_ptr m_templateParameterList; NameAST::Node m_name; AST::Node m_typeId; @@ -446,7 +360,7 @@ private: class DeclarationAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Declaration }; DECLARE_ALLOC( DeclarationAST ) @@ -462,7 +376,7 @@ private: class AccessDeclarationAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_AccessDeclaration }; DECLARE_ALLOC( AccessDeclarationAST ) @@ -486,7 +400,7 @@ private: class TypeSpecifierAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_TypeSpecifier }; DECLARE_ALLOC( TypeSpecifierAST ) @@ -518,7 +432,7 @@ private: class BaseSpecifierAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_BaseSpecifier }; DECLARE_ALLOC( BaseSpecifierAST ) @@ -548,7 +462,7 @@ private: class BaseClauseAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_BaseClause }; DECLARE_ALLOC( BaseClauseAST ) @@ -570,7 +484,7 @@ private: class ClassSpecifierAST: public TypeSpecifierAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_ClassSpecifier }; DECLARE_ALLOC( ClassSpecifierAST ) @@ -603,7 +517,7 @@ private: class EnumeratorAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Enumerator }; DECLARE_ALLOC( EnumeratorAST ) @@ -629,7 +543,7 @@ private: class EnumSpecifierAST: public TypeSpecifierAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_EnumSpecifier }; DECLARE_ALLOC( EnumSpecifierAST ) @@ -651,7 +565,7 @@ private: class ElaboratedTypeSpecifierAST: public TypeSpecifierAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_ElaboratedTypeSpecifier }; DECLARE_ALLOC( ElaboratedTypeSpecifierAST ) @@ -676,7 +590,7 @@ private: class LinkageBodyAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_LinkageBody }; DECLARE_ALLOC( LinkageBodyAST ) @@ -698,7 +612,7 @@ private: class LinkageSpecificationAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_LinkageSpecification }; DECLARE_ALLOC( LinkageSpecificationAST ) @@ -728,7 +642,7 @@ private: class NamespaceAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Namespace }; DECLARE_ALLOC( NamespaceAST ) @@ -754,7 +668,7 @@ private: class NamespaceAliasAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_NamespaceAlias }; DECLARE_ALLOC( NamespaceAliasAST ) @@ -780,7 +694,7 @@ private: class UsingAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Using }; DECLARE_ALLOC( UsingAST ) @@ -806,7 +720,7 @@ private: class UsingDirectiveAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_UsingDirective }; DECLARE_ALLOC( UsingDirectiveAST ) @@ -828,7 +742,7 @@ private: class DeclaratorAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Declarator }; DECLARE_ALLOC( DeclaratorAST ) @@ -840,7 +754,7 @@ public: void addPtrOp( AST::Node& ptrOp ); DeclaratorAST* subDeclarator() { return m_subDeclarator.get(); } - void setSubDeclarator( AUTO_PTR& subDeclarator ); + void setSubDeclarator( std::auto_ptr& subDeclarator ); NameAST* declaratorId() { return m_declaratorId.get(); } void setDeclaratorId( NameAST::Node& declaratorId ); @@ -852,7 +766,7 @@ public: void addArrayDimension( AST::Node& arrayDimension ); class ParameterDeclarationClauseAST* parameterDeclarationClause() { return m_parameterDeclarationClause.get(); } - void setParameterDeclarationClause( AUTO_PTR& parameterDeclarationClause ); + void setParameterDeclarationClause( std::auto_ptr& parameterDeclarationClause ); // ### replace 'constant' with cvQualify AST* constant() { return m_constant.get(); } @@ -863,11 +777,11 @@ public: private: TQPtrList m_ptrOpList; - AUTO_PTR m_subDeclarator; + std::auto_ptr m_subDeclarator; NameAST::Node m_declaratorId; AST::Node m_bitfieldInitialization; TQPtrList m_arrayDimensionList; - AUTO_PTR m_parameterDeclarationClause; + std::auto_ptr m_parameterDeclarationClause; AST::Node m_constant; GroupAST::Node m_exceptionSpecification; @@ -879,7 +793,7 @@ private: class ParameterDeclarationAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_ParameterDeclaration }; DECLARE_ALLOC( ParameterDeclarationAST ) @@ -911,7 +825,7 @@ private: class ParameterDeclarationListAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_ParameterDeclarationList }; DECLARE_ALLOC( ParameterDeclarationListAST ) @@ -935,7 +849,7 @@ private: class ParameterDeclarationClauseAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_ParameterDeclarationClause }; DECLARE_ALLOC( ParameterDeclarationClauseAST ) @@ -964,7 +878,7 @@ private: class InitDeclaratorAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_InitDeclarator }; DECLARE_ALLOC( InitDeclaratorAST ) @@ -990,7 +904,7 @@ private: class InitDeclaratorListAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_InitDeclaratorList }; DECLARE_ALLOC( InitDeclaratorListAST ) @@ -1012,7 +926,7 @@ private: class TypedefAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Typedef }; DECLARE_ALLOC( TypedefAST ) @@ -1038,7 +952,7 @@ private: class TemplateParameterAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_TemplateParameter }; DECLARE_ALLOC( TemplateParameterAST ) @@ -1064,7 +978,7 @@ private: class TemplateParameterListAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_TemplateParameterList }; DECLARE_ALLOC( TemplateParameterListAST ) @@ -1086,7 +1000,7 @@ private: class TemplateDeclarationAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_TemplateDeclaration }; DECLARE_ALLOC( TemplateDeclarationAST ) @@ -1116,7 +1030,7 @@ private: class SimpleDeclarationAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_SimpleDeclaration }; DECLARE_ALLOC( SimpleDeclarationAST ) @@ -1154,7 +1068,7 @@ private: class StatementAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Statement }; DECLARE_ALLOC( StatementAST ) @@ -1170,7 +1084,7 @@ private: class ExpressionStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_ExpressionStatement }; DECLARE_ALLOC( ExpressionStatementAST ) @@ -1192,7 +1106,7 @@ private: class ConditionAST: public AST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_Condition }; DECLARE_ALLOC( ConditionAST ) @@ -1222,7 +1136,7 @@ private: class IfStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_IfStatement }; DECLARE_ALLOC( IfStatementAST ) @@ -1252,7 +1166,7 @@ private: class WhileStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_WhileStatement }; DECLARE_ALLOC( WhileStatementAST ) @@ -1278,7 +1192,7 @@ private: class DoStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_DoStatement }; DECLARE_ALLOC( DoStatementAST ) @@ -1304,7 +1218,7 @@ private: class ForStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_ForStatement }; DECLARE_ALLOC( ForStatementAST ) @@ -1339,7 +1253,7 @@ private: class ForEachStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_ForEachStatement }; DECLARE_ALLOC( ForEachStatementAST ) @@ -1369,7 +1283,7 @@ private: class SwitchStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_SwitchStatement }; DECLARE_ALLOC( SwitchStatementAST ) @@ -1395,7 +1309,7 @@ private: class StatementListAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_StatementList }; DECLARE_ALLOC( StatementListAST ) @@ -1417,7 +1331,7 @@ private: class CatchStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_CatchStatement }; DECLARE_ALLOC( CatchStatementAST ) @@ -1443,7 +1357,7 @@ private: class CatchStatementListAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_CatchStatementList }; DECLARE_ALLOC( CatchStatementListAST ) @@ -1465,7 +1379,7 @@ private: class TryBlockStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_TryBlockStatement }; DECLARE_ALLOC( TryBlockStatementAST ) @@ -1491,7 +1405,7 @@ private: class DeclarationStatementAST: public StatementAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_DeclarationStatement }; DECLARE_ALLOC( DeclarationStatementAST ) @@ -1513,7 +1427,7 @@ private: class FunctionDefinitionAST: public DeclarationAST { public: - typedef AUTO_PTR Node; + typedef std::auto_ptr Node; enum { Type = NodeType_FunctionDefinition }; DECLARE_ALLOC( FunctionDefinitionAST ) -- cgit v1.2.1