Synopsis - Cross-Reference
File: /Synopsis/Parsers/IDL/idlvalidate.cc1// -*- c++ -*- 2// Package : omniidl 3// idlvalidate.cc Created on: 1999/10/26 4// Author : Duncan Grisby (dpg1) 5// 6// Copyright (C) 1999 AT&T Laboratories Cambridge 7// 8// This file is part of omniidl. 9// 10// omniidl is free software; you can redistribute it and/or modify it 11// under the terms of the GNU General Public License as published by 12// the Free Software Foundation; either version 2 of the License, or 13// (at your option) any later version. 14// 15// This program is distributed in the hope that it will be useful, 16// but WITHOUT ANY WARRANTY; without even the implied warranty of 17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18// General Public License for more details. 19// 20// You should have received a copy of the GNU General Public License 21// along with this program; if not, write to the Free Software 22// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 23// 02111-1307, USA. 24// 25// Description: 26// 27// Visitor object to validate the tree 28 29// $Id: idlvalidate.cc,v 1.7.2.1 2003/03/23 21:01:43 dgrisby Exp $ 30// $Log: idlvalidate.cc,v $ 31// Revision 1.7.2.1 2003/03/23 21:01:43 dgrisby 32// Start of omniORB 4.1.x development branch. 33// 34// Revision 1.4.2.3 2001/10/17 16:48:34 dpg1 35// Minor error message tweaks 36// 37// Revision 1.4.2.2 2000/11/01 15:44:56 dpg1 38// Support for forward-declared structs and unions 39// 40// Revision 1.4.2.1 2000/07/17 10:36:05 sll 41// Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. 42// 43// Revision 1.5 2000/07/13 15:25:52 dpg1 44// Merge from omni3_develop for 3.0 release. 45// 46// Revision 1.2.2.1 2000/03/06 15:03:47 dpg1 47// Minor bug fixes to omniidl. New -nf and -k flags. 48// 49// Revision 1.2 1999/11/02 17:07:24 dpg1 50// Changes to compile on Solaris. 51// 52// Revision 1.1 1999/10/27 14:05:53 dpg1 53// *** empty log message *** 54// 55 56#include <idlvalidate.h> 57#include <idlerr.h> 58#include <idlast.h> 59#include <idlconfig.h> 60 61void 62AstValidateVisitor:: 63visitAST(AST* a) 64{ 65 for (Decl* d = a->declarations(); d; d = d->next()) 66 d->accept(*this); 67} 68 69void 70AstValidateVisitor:: 71visitModule(Module* m) 72{ 73 for (Decl* d = m->definitions(); d; d = d->next()) 74 d->accept(*this); 75} 76 77void 78AstValidateVisitor:: 79visitInterface(Interface* i) 80{ 81 for (Decl* d = i->contents(); d; d = d->next()) 82 d->accept(*this); 83} 84 85void 86AstValidateVisitor:: 87visitForward(Forward* f) 88{ 89 if (Config::forwardWarning) { 90 if (f->isFirst() && !f->definition()) { 91 char* ssn = f->scopedName()->toString(); 92 IdlWarning(f->file(), f->line(), 93 "Forward declared interface '%s' was never fully defined", 94 ssn); 95 delete [] ssn; 96 } 97 } 98} 99 100void 101AstValidateVisitor:: 102visitValueForward(ValueForward* f) 103{ 104 if (Config::forwardWarning) { 105 if (f->isFirst() && !f->definition()) { 106 char* ssn = f->scopedName()->toString(); 107 IdlWarning(f->file(), f->line(), 108 "Forward declared valuetype '%s' was never fully defined", 109 ssn); 110 delete [] ssn; 111 } 112 } 113} 114 115void 116AstValidateVisitor:: 117visitStructForward(StructForward* f) 118{ 119 if (f->isFirst() && !f->definition()) { 120 char* ssn = f->scopedName()->toString(); 121 IdlError(f->file(), f->line(), 122 "Forward declared struct '%s' was never fully defined", ssn); 123 delete [] ssn; 124 } 125} 126 127void 128AstValidateVisitor:: 129visitUnionForward(UnionForward* f) 130{ 131 if (f->isFirst() && !f->definition()) { 132 char* ssn = f->scopedName()->toString(); 133 IdlError(f->file(), f->line(), 134 "Forward declared union '%s' was never fully defined", ssn); 135 delete [] ssn; 136 } 137}