5 Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
6 States of America. All Rights Reserved.
8 This product is protected by copyright and distributed under the following
9 license restricting its use.
11 The Interface Definition Language Compiler Front End (CFE) is made
12 available for your use provided that you include this license and copyright
13 notice on all media and documentation and the software program in which
14 this product is incorporated in whole or part. You may copy and extend
15 functionality (but may not remove functionality) of the Interface
16 Definition Language CFE without charge, but you are not authorized to
17 license or distribute it to anyone else except as part of a product or
18 program developed by you or with the express written consent of Sun
19 Microsystems, Inc. ("Sun".
21 The names of Sun Microsystems, Inc. and any of its subsidiaries or
22 affiliates may not be used in advertising or publicity pertaining to
23 distribution of Interface Definition Language CFE as permitted herein.
25 This license is effective until terminated by Sun for failure to comply
26 with this license. Upon termination, you shall destroy or return all code
27 and documentation for the Interface Definition Language CFE.
29 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
30 ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
32 DEALING, USAGE OR TRADE PRACTICE.
34 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
35 ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
36 TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
38 SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
39 RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
40 INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
42 IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
43 ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
44 DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
46 Use, duplication, or disclosure by the government is subject to
47 restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
48 Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
51 Sun, Sun Microsystems and the Sun logo are trademarks or registered
52 trademarks of Sun Microsystems, Inc.
56 Mountain View, California 94043
60 SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
61 trademarks or registered trademarks of Sun Microsystems, Inc.
65 // utl_err.cc - Implementation of error reporting object for IDL
69 #include "utl_identifier.h"
70 #include "utl_string.h"
71 #include "global_extern.h"
72 #include "nr_extern.h"
73 #include "fe_extern.h"
74 #include "idl_defines.h"
76 #include "ast_interface.h"
78 #include "ast_fixed.h"
79 #include "ast_union.h"
80 #include "ast_union_label.h"
81 #include "ast_annotation_decl.h"
82 #include "ast_annotation_member.h"
83 #include "ast_annotation_appl.h"
85 // FUZZ: disable check_for_streams_include
86 #include "ace/streams.h"
88 #include "ace/Log_Msg.h"
90 // Convert an error code into a const char *
92 error_string (UTL_Error::ErrorCode c
)
96 case UTL_Error::EIDL_OK
:
97 return "all is fine ";
98 case UTL_Error::EIDL_SYNTAX_ERROR
:
100 case UTL_Error::EIDL_REDEF
:
101 return "illegal redefinition ";
102 case UTL_Error::EIDL_DEF_USE
:
103 return "redefinition after use, ";
104 case UTL_Error::EIDL_MULTIPLE_BRANCH
:
105 return "union with duplicate branch label ";
106 case UTL_Error::EIDL_COERCION_FAILURE
:
107 return "coercion failure ";
108 case UTL_Error::EIDL_SCOPE_CONFLICT
:
109 return "definition scope is different than fwd declare scope, ";
110 case UTL_Error::EIDL_ONEWAY_CONFLICT
:
111 return "oneway operation with OUT or INOUT parameters, ";
112 case UTL_Error::EIDL_PREFIX_CONFLICT
:
113 return "prefix at declaration differs from prefix at definition or use, ";
114 case UTL_Error::EIDL_ILLEGAL_VERSION
:
115 return "illegal #pragma version, ";
116 case UTL_Error::EIDL_VERSION_RESET
:
117 return "version already set by #pragma version or #pragma id, ";
118 case UTL_Error::EIDL_ID_RESET
:
119 return "cannot reset id to a different string, ";
120 case UTL_Error::EIDL_TYPEID_RESET
:
121 return "repo id already set by previous call to 'typeid', ";
122 case UTL_Error::EIDL_INVALID_TYPEID
:
123 return "'typeid' may not be applied to this type, ";
124 case UTL_Error::EIDL_INVALID_TYPEPREFIX
:
125 return "'typeprefix' may not be applied to this type, ";
126 case UTL_Error::EIDL_DISC_TYPE
:
127 return "union with illegal discriminator type, ";
128 case UTL_Error::EIDL_LABEL_TYPE
:
129 return "label type incompatible with union discriminator type, ";
130 case UTL_Error::EIDL_ILLEGAL_ADD
:
131 return "illegal use of incomplete type, ";
132 case UTL_Error::EIDL_ILLEGAL_USE
:
133 return "illegal type used in expression, ";
134 case UTL_Error::EIDL_ILLEGAL_RAISES
:
135 return "error in or illegal use of raises(..) clause, ";
136 case UTL_Error::EIDL_ILLEGAL_CONTEXT
:
137 return "error in context(..) clause, ";
138 case UTL_Error::EIDL_CANT_INHERIT
:
139 // More intelligible message printed by error routine.
141 case UTL_Error::EIDL_CANT_SUPPORT
:
142 // More intelligible message printed by error routine.
144 case UTL_Error::EIDL_LOOKUP_ERROR
:
145 return "error in lookup of symbol: ";
146 case UTL_Error::EIDL_INHERIT_FWD_ERROR
:
147 // More intelligible message printed by error routine.
149 case UTL_Error::EIDL_SUPPORTS_FWD_ERROR
:
150 // More intelligible message printed by error routine.
152 case UTL_Error::EIDL_PRIMARY_KEY_ERROR
:
153 // More intelligible message printed by error routine.
155 case UTL_Error::EIDL_CONSTANT_EXPECTED
:
156 return "constant expected: ";
157 case UTL_Error::EIDL_INTERFACE_EXPECTED
:
158 return "interface expected: ";
159 case UTL_Error::EIDL_VALUETYPE_EXPECTED
:
160 return "value type expected: ";
161 case UTL_Error::EIDL_CONCRETE_VT_EXPECTED
:
162 return "concrete value type expected: ";
163 case UTL_Error::EIDL_ABSTRACT_EXPECTED
:
164 return "abstract type expected: ";
165 case UTL_Error::EIDL_EVENTTYPE_EXPECTED
:
166 return "event type expected: ";
167 case UTL_Error::EIDL_TMPL_MODULE_EXPECTED
:
168 return "template module expected: ";
169 case UTL_Error::EIDL_PORTTYPE_EXPECTED
:
170 return "porttype expected: ";
171 case UTL_Error::EIDL_CONNECTOR_EXPECTED
:
172 return "connector expected: ";
173 case UTL_Error::EIDL_TYPEDEF_EXPECTED
:
174 return "typedef expected: ";
175 case UTL_Error::EIDL_EVAL_ERROR
:
176 return "expression evaluation error: ";
177 case UTL_Error::EIDL_INCOMPATIBLE_TYPE
:
178 return "incompatible types in constant assignment: ";
179 case UTL_Error::EIDL_NAME_CASE_ERROR
:
180 return "identifier spellings differ only in case: ";
181 case UTL_Error::EIDL_NAME_CASE_WARNING
:
182 return "Warning - identifier spellings differ only in case: ";
183 case UTL_Error::EIDL_KEYWORD_ERROR
:
184 return "spelling differs from IDL keyword only in case: ";
185 case UTL_Error::EIDL_KEYWORD_WARNING
:
186 return "Warning - spelling differs from IDL keyword only in case: ";
187 case UTL_Error::EIDL_ANONYMOUS_ERROR
:
188 return "anonymous types require the IDL version to be 4 or later or must "
189 "be explictly enabled using -as";
190 case UTL_Error::EIDL_ANONYMOUS_WARNING
:
191 return "anonymous type found";
192 case UTL_Error::EIDL_ANONYMOUS_EXPLICIT_ERROR
:
193 return "anonymous types have been disabled";
194 case UTL_Error::EIDL_ENUM_VAL_EXPECTED
:
195 return "enumerator expected: ";
196 case UTL_Error::EIDL_ENUM_VAL_NOT_FOUND
:
197 return "enumerator by this name not defined: ";
198 case UTL_Error::EIDL_AMBIGUOUS
:
199 return "ambiguous definition: ";
200 case UTL_Error::EIDL_DECL_NOT_DEFINED
:
201 return "forward declared but never defined: ";
202 case UTL_Error::EIDL_FWD_DECL_LOOKUP
:
203 /* More intelligible message printed by error routine */
205 case UTL_Error::EIDL_RECURSIVE_TYPE
:
206 return "illegal recursive use of type: ";
207 case UTL_Error::EIDL_NONVOID_ONEWAY
:
208 return "non-void return type in oneway operation: ";
209 case UTL_Error::EIDL_REDEF_SCOPE
:
210 return "redefinition inside defining scope: ";
211 case UTL_Error::EIDL_NOT_A_TYPE
:
212 return "specified symbol is not a type: ";
213 case UTL_Error::EIDL_UNDERSCORE
:
214 return "identifier has more than one leading underscore: ";
215 case UTL_Error::EIDL_EMPTY_MODULE
:
216 return "module must contain at least one declaration: ";
217 case UTL_Error::EIDL_BACK_END
:
219 case UTL_Error::EIDL_ILLEGAL_INFIX
:
220 return "illegal infix operator in expression";
221 case UTL_Error::EIDL_LOCAL_REMOTE_MISMATCH
:
223 case UTL_Error::EIDL_IGNORE_IDL3_ERROR
:
224 return "improper use of -Sm option with ";
225 case UTL_Error::EIDL_TC_SUPPRESSION_WARNING
:
226 /* More intelligible message printed by warning routine */
228 case UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
:
229 return "valuetype not allowed as type of boxed value type";
230 case UTL_Error::EIDL_ILLEGAL_PRIMARY_KEY
:
231 return "illegal primary key";
232 case UTL_Error::EIDL_MISMATCHED_T_PARAM
:
233 return "mismatched template parameter";
234 case UTL_Error::EIDL_DUPLICATE_T_PARAM
:
235 return "duplicate template parameter id";
236 case UTL_Error::EIDL_T_ARG_LENGTH
:
237 return "wrong # of template args";
238 case UTL_Error::EIDL_MISMATCHED_SEQ_PARAM
:
239 return "no match for identifier";
240 case UTL_Error::EIDL_TEMPLATE_NOT_ALIASED
:
241 return "ref to template module scope must be via alias";
242 case UTL_Error::EIDL_FIXED_UNSUPPORTED
:
243 return "fixed data types are not supported";
244 case UTL_Error::EIDL_IDL_VERSION_ERROR
:
245 return "Invalid use of this version of IDL";
246 case UTL_Error::EIDL_ANNOTATION_PARAM_ERROR
:
247 return "Error in annotation parameter(s): ";
248 case UTL_Error::EIDL_UNSUPPORTED
:
249 case UTL_Error::EIDL_MISC
:
250 return ""; // Supply Case by Case Message
253 return "<This error code is missing a string in error_string "
259 * Get filename from node or from idl_global if node is null.
262 get_filename (AST_Decl
*node
= nullptr)
264 return node
? node
->file_name ().c_str ()
265 : idl_global
->filename ()->get_string ();
269 * Get line number from node or from idl_global if node is null.
272 get_lineno (AST_Decl
*node
= nullptr)
274 return node
? node
->line () : idl_global
->lineno ();
278 * Common Error Message Header
282 idl_error_header (UTL_Error::ErrorCode c
, long lineno
, ACE_CString s
)
284 idl_global
->err ()->last_error
= c
;
285 const long line_number
= lineno
== -1 ? idl_global
->lineno () : lineno
;
286 idl_global
->err ()->last_error_lineno
= line_number
;
287 ACE_ERROR ((LM_ERROR
,
288 "Error - %C: \"%C\", line %d: %C",
289 idl_global
->prog_name (),
293 idl_global
->set_err_count (idl_global
->err_count () + 1);
296 idl_error_header (UTL_Error::ErrorCode c
, AST_Decl
*node
= nullptr)
298 idl_error_header (c
, get_lineno (node
), get_filename (node
));
303 * Common Warning Message Header
307 idl_warning_header (UTL_Error::ErrorCode c
, long lineno
, ACE_CString s
)
309 idl_global
->err ()->last_warning
= c
;
310 const long line_number
= lineno
== -1 ? idl_global
->lineno () : lineno
;
311 idl_global
->err ()->last_warning_lineno
= lineno
;
312 ACE_ERROR ((LM_WARNING
,
313 "Warning - %C: \"%C\", line %d: %C",
314 idl_global
->prog_name (),
320 idl_warning_header (UTL_Error::ErrorCode c
, AST_Decl
*node
= nullptr)
322 idl_warning_header (c
, get_lineno (node
), get_filename (node
));
326 // Convert a parse state into a possible error message
328 parse_state_to_error_message (IDL_GlobalData::ParseState ps
)
332 case IDL_GlobalData::PS_NoState
:
333 return "Statement cannot be parsed";
334 case IDL_GlobalData::PS_TypeDeclSeen
:
335 return "Malformed type declaration";
336 case IDL_GlobalData::PS_TypeIdDeclSeen
:
337 return "Malformed type id declaration";
338 case IDL_GlobalData::PS_TypePrefixDeclSeen
:
339 return "Malformed type prefix declaration";
340 case IDL_GlobalData::PS_ConstDeclSeen
:
341 return "Malformed const declaration";
342 case IDL_GlobalData::PS_ExceptDeclSeen
:
343 return "Malformed exception declaration";
344 case IDL_GlobalData::PS_InterfaceDeclSeen
:
345 return "Malformed interface declaration";
346 case IDL_GlobalData::PS_ValueTypeDeclSeen
:
347 return "Malformed value type declaration";
348 case IDL_GlobalData::PS_ComponentDeclSeen
:
349 return "Malformed component declaration";
350 case IDL_GlobalData::PS_HomeDeclSeen
:
351 return "Malformed home declaration";
352 case IDL_GlobalData::PS_EventDeclSeen
:
353 return "Malformed event type declaration";
354 case IDL_GlobalData::PS_PorttypeDeclSeen
:
355 return "Malformed port type declaration";
356 case IDL_GlobalData::PS_ConnectorDeclSeen
:
357 return "Malformed connector declaration";
358 case IDL_GlobalData::PS_ModuleDeclSeen
:
359 return "Malformed module declaration";
360 case IDL_GlobalData::PS_AttrDeclSeen
:
361 return "Malformed attribute declaration";
362 case IDL_GlobalData::PS_OpDeclSeen
:
363 return "Malformed operation declaration";
364 case IDL_GlobalData::PS_ProvidesDeclSeen
:
365 return "Malformed simple provides declaration";
366 case IDL_GlobalData::PS_ExtProvidesDeclSeen
:
367 return "Malformed extended provides declaration";
368 case IDL_GlobalData::PS_UsesDeclSeen
:
369 return "Malformed simple uses declaration";
370 case IDL_GlobalData::PS_ExtUsesDeclSeen
:
371 return "Malformed extended uses declaration";
372 case IDL_GlobalData::PS_EmitsDeclSeen
:
373 return "Malformed emits declaration";
374 case IDL_GlobalData::PS_PublishesDeclSeen
:
375 return "Malformed publishes declaration";
376 case IDL_GlobalData::PS_ConsumesDeclSeen
:
377 return "Malformed consumes declaration";
378 case IDL_GlobalData::PS_ExtendedPortDeclSeen
:
379 return "Malformed extended port declaration";
380 case IDL_GlobalData::PS_MirrorPortDeclSeen
:
381 return "Malformed mirror port declaration";
382 case IDL_GlobalData::PS_FactoryDeclSeen
:
383 return "Malformed factory declaration";
384 case IDL_GlobalData::PS_FinderDeclSeen
:
385 return "Malformed finder declaration";
386 case IDL_GlobalData::PS_ModuleSeen
:
387 return "Missing module identifier following MODULE keyword";
388 case IDL_GlobalData::PS_ModuleIDSeen
:
389 return "Missing '{' or illegal syntax following module identifier";
390 case IDL_GlobalData::PS_ModuleSqSeen
:
391 return "Illegal syntax following module '{' opener";
392 case IDL_GlobalData::PS_ModuleQsSeen
:
393 return "Illegal syntax following module '}' closer";
394 case IDL_GlobalData::PS_ModuleBodySeen
:
395 return "Illegal syntax following module body statement(s)";
396 case IDL_GlobalData::PS_InheritColonSeen
:
397 return "Illegal syntax following ':' starting inheritance list";
398 case IDL_GlobalData::PS_InheritSpecSeen
:
399 return "Missing '{' or illegal syntax following inheritance spec";
400 case IDL_GlobalData::PS_SupportSpecSeen
:
401 return "Missing '{' or illegal syntax following support spec";
402 case IDL_GlobalData::PS_ManagesSeen
:
403 return "Missing component identifier following MANAGES keyword";
404 case IDL_GlobalData::PS_ManagesIDSeen
:
405 return "Illegal syntax following managed component identifier";
406 case IDL_GlobalData::PS_PrimaryKeySpecSeen
:
407 return "Illegal syntax following primary key spec";
408 case IDL_GlobalData::PS_InterfaceSeen
:
409 return "Missing interface identifier following INTERFACE keyword";
410 case IDL_GlobalData::PS_InterfaceForwardSeen
:
411 return "Missing ';' following forward interface declaration";
412 case IDL_GlobalData::PS_InterfaceIDSeen
:
413 return "Missing '{' or illegal syntax following interface identifier";
414 case IDL_GlobalData::PS_InterfaceSqSeen
:
415 return "Illegal syntax following interface '{' opener";
416 case IDL_GlobalData::PS_InterfaceQsSeen
:
417 return "Illegal syntax following interface '}' closer";
418 case IDL_GlobalData::PS_InterfaceBodySeen
:
419 return "Illegal syntax following interface body statement(s)";
420 case IDL_GlobalData::PS_TmplModuleIDSeen
:
421 return "Illegal syntax following '<' in template module";
422 case IDL_GlobalData::PS_TmplModuleParamsSeen
:
423 return "Illegal syntax following '>' in template module";
424 case IDL_GlobalData::PS_TmplModuleSqSeen
:
425 return "Illegal syntax or missing type following '{' in template module";
426 case IDL_GlobalData::PS_TmplModuleQsSeen
:
427 return "Illegal syntax or missing type following '}' in template module";
428 case IDL_GlobalData::PS_TmplModuleBodySeen
:
429 return "Illegal syntax following template module body statement(s)";
430 case IDL_GlobalData::PS_InstModuleSeen
:
431 return "Illegal syntax following following '<' of module instantiation";
432 case IDL_GlobalData::PS_InstModuleArgsSeen
:
433 return "Illegal syntax following following template args";
434 case IDL_GlobalData::PS_InstModuleIDSeen
:
435 return "Illegal syntax following following instantiated module identifier";
436 case IDL_GlobalData::PS_ModuleRefSeen
:
437 return "Mising '<' or illegal syntax in template module alias";
438 case IDL_GlobalData::PS_ModuleRefParamsSeen
:
439 return "Illegal syntax following module alias param names";
440 case IDL_GlobalData::PS_ModuleRefIDSeen
:
441 return "Illegal syntax following module alias identifier";
442 case IDL_GlobalData::PS_ValueTypeSeen
:
443 return "Missing interface identifier following VALUETYPE keyword";
444 case IDL_GlobalData::PS_ValueTypeForwardSeen
:
445 return "Missing ';' following forward value type declaration";
446 case IDL_GlobalData::PS_ValueTypeIDSeen
:
447 return "Missing '{' or illegal syntax following value type identifier";
448 case IDL_GlobalData::PS_ValueTypeSqSeen
:
449 return "Illegal syntax following value type '{' opener";
450 case IDL_GlobalData::PS_ValueTypeQsSeen
:
451 return "Illegal syntax following value type '}' closer";
452 case IDL_GlobalData::PS_ValueTypeBodySeen
:
453 return "Illegal syntax following value type body statement(s)";
454 case IDL_GlobalData::PS_EventTypeSeen
:
455 return "Missing interface identifier following EVENTTYPE keyword";
456 case IDL_GlobalData::PS_EventTypeForwardSeen
:
457 return "Missing ';' following forward event type declaration";
458 case IDL_GlobalData::PS_EventTypeIDSeen
:
459 return "Missing '{' or illegal syntax following event type identifier";
460 case IDL_GlobalData::PS_EventTypeSqSeen
:
461 return "Illegal syntax following event type '{' opener";
462 case IDL_GlobalData::PS_EventTypeQsSeen
:
463 return "Illegal syntax following event type '}' closer";
464 case IDL_GlobalData::PS_EventTypeBodySeen
:
465 return "Illegal syntax following event type body statement(s)";
466 case IDL_GlobalData::PS_ComponentSeen
:
467 return "Missing component identifier following COMPONENT keyword";
468 case IDL_GlobalData::PS_ComponentForwardSeen
:
469 return "Missing ';' following forward component declaration";
470 case IDL_GlobalData::PS_ComponentIDSeen
:
471 return "Missing '{' or illegal syntax following component identifier";
472 case IDL_GlobalData::PS_ComponentSqSeen
:
473 return "Illegal syntax following component '{' opener";
474 case IDL_GlobalData::PS_ComponentQsSeen
:
475 return "Illegal syntax following component '}' closer";
476 case IDL_GlobalData::PS_ComponentBodySeen
:
477 return "Illegal syntax following component body statement(s)";
478 case IDL_GlobalData::PS_HomeSeen
:
479 return "Missing component identifier following HOME keyword";
480 case IDL_GlobalData::PS_HomeIDSeen
:
481 return "Missing '{' or illegal syntax following home identifier";
482 case IDL_GlobalData::PS_HomeSqSeen
:
483 return "Illegal syntax following home '{' opener";
484 case IDL_GlobalData::PS_HomeQsSeen
:
485 return "Illegal syntax following home '}' closer";
486 case IDL_GlobalData::PS_HomeBodySeen
:
487 return "Illegal syntax following home body statement(s)";
488 case IDL_GlobalData::PS_ConnectorSeen
:
489 return "Missing connector identifier following CONNECTOR keyword";
490 case IDL_GlobalData::PS_ConnectorIDSeen
:
491 return "Missing '{' or illegal syntax following connector identifier";
492 case IDL_GlobalData::PS_ConnectorSqSeen
:
493 return "Illegal syntax following connector '{' opener";
494 case IDL_GlobalData::PS_ConnectorQsSeen
:
495 return "Illegal syntax following connector '}' closer";
496 case IDL_GlobalData::PS_ConnectorBodySeen
:
497 return "Illegal syntax following connector body statement(s)";
498 case IDL_GlobalData::PS_StructForwardSeen
:
499 return "Missing ';' following forward struct declaration";
500 case IDL_GlobalData::PS_UnionForwardSeen
:
501 return "Missing ';' following forward union declaration";
502 case IDL_GlobalData::PS_SNListCommaSeen
:
503 return "Found illegal scoped name in scoped name list";
504 case IDL_GlobalData::PS_ScopedNameSeen
:
505 return "Missing ',' following scoped name in scoped name list";
506 case IDL_GlobalData::PS_SN_IDSeen
:
507 return "Illegal component in scoped name";
508 case IDL_GlobalData::PS_ScopeDelimSeen
:
509 return "Illegal component in scoped name following '::'";
510 case IDL_GlobalData::PS_ConstSeen
:
511 return "Missing type or illegal syntax following CONST keyword";
512 case IDL_GlobalData::PS_ConstTypeSeen
:
513 return "Missing identifier or illegal syntax following const type";
514 case IDL_GlobalData::PS_ConstIDSeen
:
515 return "Missing '=' or illegal syntax after const identifier";
516 case IDL_GlobalData::PS_ConstAssignSeen
:
517 return "Missing value expr or illegal syntax following '='";
518 case IDL_GlobalData::PS_ConstExprSeen
:
519 return "Missing ';' or illegal syntax following value expr in const";
520 case IDL_GlobalData::PS_TypedefSeen
:
521 return "Missing type or illegal syntax following TYPEDEF keyword";
522 case IDL_GlobalData::PS_TypeSpecSeen
:
523 return "Missing declarators or illegal syntax following type spec";
524 case IDL_GlobalData::PS_DeclaratorsSeen
:
525 return "Illegal syntax following declarators in TYPEDEF declaration";
526 case IDL_GlobalData::PS_StructSeen
:
527 return "Missing struct identifier following STRUCT keyword";
528 case IDL_GlobalData::PS_StructIDSeen
:
529 return "Missing '{' or illegal syntax following struct identifier";
530 case IDL_GlobalData::PS_StructSqSeen
:
531 return "Illegal syntax following struct '{' opener";
532 case IDL_GlobalData::PS_StructQsSeen
:
533 return "Illegal syntax following struct '}' closer";
534 case IDL_GlobalData::PS_StructBodySeen
:
535 return "Illegal syntax following struct body statement(s)";
536 case IDL_GlobalData::PS_MemberTypeSeen
:
537 return "Illegal syntax or missing identifier following member type";
538 case IDL_GlobalData::PS_MemberDeclsSeen
:
539 return "Illegal syntax following member declarator(s)";
540 case IDL_GlobalData::PS_MemberDeclsCompleted
:
541 return "Missing ',' between member decls of same type(?)";
542 case IDL_GlobalData::PS_UnionSeen
:
543 return "Missing identifier following UNION keyword";
544 case IDL_GlobalData::PS_UnionIDSeen
:
545 return "Illegal syntax following union identifier";
546 case IDL_GlobalData::PS_SwitchSeen
:
547 return "Illegal syntax following SWITCH keyword";
548 case IDL_GlobalData::PS_SwitchOpenParSeen
:
549 return "Illegal syntax following '(' in switch in union";
550 case IDL_GlobalData::PS_SwitchTypeSeen
:
551 return "Illegal syntax following type decl in switch in union";
552 case IDL_GlobalData::PS_SwitchCloseParSeen
:
553 return "Missing union '{' opener";
554 case IDL_GlobalData::PS_UnionSqSeen
:
555 return "Illegal syntax following union '{' opener";
556 case IDL_GlobalData::PS_UnionQsSeen
:
557 return "Illegal syntax following union '}' closer";
558 case IDL_GlobalData::PS_DefaultSeen
:
559 return "Illegal syntax or missing ':' following DEFAULT keyword";
560 case IDL_GlobalData::PS_UnionLabelSeen
:
561 return "Illegal syntax following branch label in union";
562 case IDL_GlobalData::PS_LabelColonSeen
:
563 return "Illegal syntax following ':' in branch label in union";
564 case IDL_GlobalData::PS_LabelExprSeen
:
565 return "Illegal syntax following label expression in union";
566 case IDL_GlobalData::PS_UnionElemSeen
:
567 case IDL_GlobalData::PS_UnionElemCompleted
:
568 return "Illegal syntax following union element";
569 case IDL_GlobalData::PS_CaseSeen
:
570 return "Illegal syntax following CASE keyword in union";
571 case IDL_GlobalData::PS_UnionElemTypeSeen
:
572 return "Illegal syntax following type decl in union element";
573 case IDL_GlobalData::PS_UnionElemDeclSeen
:
574 return "Illegal syntax following declarator in union element";
575 case IDL_GlobalData::PS_UnionBodySeen
:
576 return "Illegal syntax following union body statement(s)";
577 case IDL_GlobalData::PS_EnumSeen
:
578 return "Illegal syntax or missing identifier following ENUM keyword";
579 case IDL_GlobalData::PS_EnumIDSeen
:
580 return "Illegal syntax or missing '{' following enum identifier";
581 case IDL_GlobalData::PS_EnumSqSeen
:
582 return "Illegal syntax following enum '{' opener";
583 case IDL_GlobalData::PS_EnumQsSeen
:
584 return "Illegal syntax following enum '}' closer";
585 case IDL_GlobalData::PS_EnumBodySeen
:
586 return "Illegal syntax following enum body statement(s)";
587 case IDL_GlobalData::PS_EnumCommaSeen
:
588 return "Illegal syntax or missing identifier following ',' in enum";
589 case IDL_GlobalData::PS_SequenceSeen
:
590 return "Illegal syntax or missing '<' following SEQUENCE keyword";
591 case IDL_GlobalData::PS_SequenceSqSeen
:
592 return "Illegal syntax or missing type following '<' in sequence";
593 case IDL_GlobalData::PS_SequenceQsSeen
:
594 return "Illegal syntax following '>' in sequence";
595 case IDL_GlobalData::PS_SequenceTypeSeen
:
596 return "Illegal syntax following sequence type declaration";
597 case IDL_GlobalData::PS_SequenceCommaSeen
:
598 return "Illegal syntax or missing size expr following ',' in sequence";
599 case IDL_GlobalData::PS_SequenceExprSeen
:
600 return "Illegal syntax or missing '>' following size expr in sequence";
601 case IDL_GlobalData::PS_StringSeen
:
602 return "Illegal syntax or missing '<' following STRING keyword";
603 case IDL_GlobalData::PS_StringSqSeen
:
604 return "Illegal syntax or missing size expr following '<' in string";
605 case IDL_GlobalData::PS_StringQsSeen
:
606 return "Illegal syntax following '>' in string";
607 case IDL_GlobalData::PS_StringExprSeen
:
608 return "Illegal syntax or missing '>' after size expr in string";
609 case IDL_GlobalData::PS_StringCompleted
:
610 return "Illegal syntax after string declaration";
611 case IDL_GlobalData::PS_ArrayIDSeen
:
612 return "Illegal syntax or missing dimensions after array identifier";
613 case IDL_GlobalData::PS_ArrayCompleted
:
614 return "Illegal syntax after array declaration";
615 case IDL_GlobalData::PS_DimSqSeen
:
616 return "Illegal syntax or missing size expr after '[' in array declaration";
617 case IDL_GlobalData::PS_DimQsSeen
:
618 return "Illegal syntax after ']' in array declaration";
619 case IDL_GlobalData::PS_DimExprSeen
:
620 return "Illegal syntax or missing ']' after size expr in array declaration";
621 case IDL_GlobalData::PS_AttrROSeen
:
622 return "Illegal syntax after READONLY keyword";
623 case IDL_GlobalData::PS_AttrSeen
:
624 return "Illegal syntax after ATTRIBUTE keyword";
625 case IDL_GlobalData::PS_AttrTypeSeen
:
626 return "Illegal syntax after type in attribute declaration";
627 case IDL_GlobalData::PS_AttrDeclsSeen
:
628 return "Illegal syntax after attribute declarators";
629 case IDL_GlobalData::PS_AttrCompleted
:
630 return "Illegal syntax after attribute declaration";
631 case IDL_GlobalData::PS_ExceptSeen
:
632 return "Illegal syntax or missing identifier after EXCEPTION keyword";
633 case IDL_GlobalData::PS_ExceptIDSeen
:
634 return "Illegal syntax or missing '{' after exception identifier";
635 case IDL_GlobalData::PS_ExceptSqSeen
:
636 return "Illegal syntax after exception '{' opener";
637 case IDL_GlobalData::PS_ExceptQsSeen
:
638 return "Illegal syntax after exception '}' closer";
639 case IDL_GlobalData::PS_ExceptBodySeen
:
640 return "Illegal syntax after exception body statement(s)";
641 case IDL_GlobalData::PS_OpAttrSeen
:
642 return "Illegal syntax or missing type after operation attribute";
643 case IDL_GlobalData::PS_OpTypeSeen
:
644 return "Illegal syntax or missing identifier after operation type";
645 case IDL_GlobalData::PS_OpIDSeen
:
646 return "Illegal syntax or missing '(' after operation identifier";
647 case IDL_GlobalData::PS_OpParsCompleted
:
648 return "Illegal syntax after operation parameter list";
649 case IDL_GlobalData::PS_OpRaiseCompleted
:
650 return "Illegal syntax after optional RAISES in operation declaration";
651 case IDL_GlobalData::PS_OpGetRaiseCompleted
:
652 return "Illegal syntax after optional GETRAISES in operation declaration";
653 case IDL_GlobalData::PS_OpSetRaiseCompleted
:
654 return "Illegal syntax after optional SETRAISES in operation declaration";
655 case IDL_GlobalData::PS_OpContextCompleted
:
656 return "Illegal syntax after optional CONTEXT in operation declaration";
657 case IDL_GlobalData::PS_OpCompleted
:
658 return "Illegal syntax after operation declaration";
659 case IDL_GlobalData::PS_OpSqSeen
:
660 return "Illegal syntax after operation parameter list '(' opener";
661 case IDL_GlobalData::PS_OpQsSeen
:
662 return "Illegal syntax after operation parameter list ')' closer";
663 case IDL_GlobalData::PS_OpParCommaSeen
:
664 return "Illegal syntax or missing direction in parameter declaration";
665 case IDL_GlobalData::PS_OpParDirSeen
:
666 return "Illegal syntax or missing type in parameter declaration";
667 case IDL_GlobalData::PS_OpParTypeSeen
:
668 return "Illegal syntax or missing declarator in parameter declaration";
669 case IDL_GlobalData::PS_OpParDeclSeen
:
670 return "Illegal syntax following parameter declarator";
671 case IDL_GlobalData::PS_OpRaiseSeen
:
672 return "Illegal syntax or missing '(' after RAISES keyword";
673 case IDL_GlobalData::PS_OpRaiseSqSeen
:
674 return "Illegal syntax after RAISES '(' opener";
675 case IDL_GlobalData::PS_OpRaiseQsSeen
:
676 return "Illegal syntax after RAISES ')' closer";
677 case IDL_GlobalData::PS_OpGetRaiseSeen
:
678 return "Illegal syntax or missing '(' after GETRAISES keyword";
679 case IDL_GlobalData::PS_OpGetRaiseSqSeen
:
680 return "Illegal syntax after GETRAISES '(' opener";
681 case IDL_GlobalData::PS_OpGetRaiseQsSeen
:
682 return "Illegal syntax after GETRAISES ')' closer";
683 case IDL_GlobalData::PS_OpSetRaiseSeen
:
684 return "Illegal syntax or missing '(' after SETRAISES keyword";
685 case IDL_GlobalData::PS_OpSetRaiseSqSeen
:
686 return "Illegal syntax after SETRAISES '(' opener";
687 case IDL_GlobalData::PS_OpSetRaiseQsSeen
:
688 return "Illegal syntax after SETRAISES ')' closer";
689 case IDL_GlobalData::PS_OpContextSeen
:
690 return "Illegal syntax or missing '(' after CONTEXT keyword";
691 case IDL_GlobalData::PS_OpContextSqSeen
:
692 return "Illegal syntax after CONTEXT '(' opener";
693 case IDL_GlobalData::PS_OpContextQsSeen
:
694 return "Illegal syntax after CONTEXT ')' closer";
695 case IDL_GlobalData::PS_OpContextCommaSeen
:
696 return "Illegal syntax after ',' in CONTEXT in operation declaration";
697 case IDL_GlobalData::PS_DeclsCommaSeen
:
698 return "Illegal syntax after ',' in declarators list";
699 case IDL_GlobalData::PS_DeclsDeclSeen
:
700 return "Illegal syntax after declarator in declarators list";
701 case IDL_GlobalData::PS_PragmaPrefixSyntax
:
702 return "Illegal syntax for #pragma prefix";
703 case IDL_GlobalData::PS_ValueBoxDeclSeen
:
704 return "Missing boxed valuetype identifier following VALUETYPE keyword";
705 case IDL_GlobalData::PS_PorttypeSeen
:
706 return "Illegal syntax or missing identifier after PORTTYPE keyword";
707 case IDL_GlobalData::PS_PorttypeIDSeen
:
708 return "Illegal syntax or missing '{' after porttype identifier";
709 case IDL_GlobalData::PS_PorttypeSqSeen
:
710 return "Illegal syntax after porttype '{' opener";
711 case IDL_GlobalData::PS_PorttypeQsSeen
:
712 return "Illegal syntax after porttype '}' closer";
713 case IDL_GlobalData::PS_PorttypeBodySeen
:
714 return "Illegal syntax after porttype body statement(s)";
716 return "Some syntax error";
720 UTL_Error::UTL_Error ()
721 : last_error (EIDL_OK
),
722 last_error_lineno (-1),
723 last_warning (EIDL_OK
),
724 last_warning_lineno (-1)
730 // Report error messages with various numbers of arguments.
733 UTL_Error::syntax_error (IDL_GlobalData::ParseState ps
)
735 idl_error_header (EIDL_SYNTAX_ERROR
,
736 idl_global
->lineno (),
737 idl_global
->filename ()->get_string ());
738 ACE_ERROR ((LM_ERROR
,
740 parse_state_to_error_message (ps
)));
742 // Better to bail here than to increment the error count and
743 // try to avoid further bogus error messages and crashes
749 UTL_Error::error0 (UTL_Error::ErrorCode c
)
751 idl_error_header (c
);
752 ACE_ERROR ((LM_ERROR
,
757 UTL_Error::error1 (UTL_Error::ErrorCode c
,
760 idl_error_header (c
);
761 ACE_ERROR ((LM_ERROR
, " - "));
762 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
763 ACE_ERROR ((LM_ERROR
,
768 UTL_Error::error2 (UTL_Error::ErrorCode c
,
772 idl_error_header (c
);
773 d1
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
774 ACE_ERROR ((LM_ERROR
,
776 d2
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
777 ACE_ERROR ((LM_ERROR
,
782 UTL_Error::error3 (UTL_Error::ErrorCode c
,
787 idl_error_header (c
);
788 d1
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
789 ACE_ERROR ((LM_ERROR
,
791 d2
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
792 ACE_ERROR ((LM_ERROR
,
794 d3
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
795 ACE_ERROR ((LM_ERROR
,
800 UTL_Error::warning0 (UTL_Error::ErrorCode c
)
802 if (! (idl_global
->compile_flags () & IDL_CF_NOWARNINGS
))
804 idl_warning_header (c
);
805 ACE_ERROR ((LM_WARNING
,
811 UTL_Error::warning1 (UTL_Error::ErrorCode c
,
814 if (! (idl_global
->compile_flags () & IDL_CF_NOWARNINGS
))
816 idl_warning_header (c
);
817 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
818 ACE_ERROR ((LM_WARNING
,
824 UTL_Error::warning2 (UTL_Error::ErrorCode c
,
828 if (! (idl_global
->compile_flags () & IDL_CF_NOWARNINGS
))
830 idl_warning_header (c
);
831 d1
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
832 ACE_ERROR ((LM_WARNING
,
834 d2
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
835 ACE_ERROR ((LM_WARNING
,
841 UTL_Error::warning3 (UTL_Error::ErrorCode c
,
846 if (! (idl_global
->compile_flags () & IDL_CF_NOWARNINGS
))
848 idl_warning_header (c
);
849 d1
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
850 ACE_ERROR ((LM_WARNING
,
852 d2
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
853 ACE_ERROR ((LM_WARNING
,
855 d3
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
856 ACE_ERROR ((LM_WARNING
,
861 // Report a failed coercion attempt.
863 UTL_Error::coercion_error (AST_Expression
*v
,
864 AST_Expression::ExprType t
)
866 idl_error_header (EIDL_COERCION_FAILURE
,
868 v
->file_name ()->get_string ());
869 v
->dump (*ACE_DEFAULT_LOG_STREAM
);
870 ACE_ERROR ((LM_ERROR
,
872 AST_Expression::exprtype_to_string (t
)));
875 // Report a failed name lookup attempt.
877 UTL_Error::lookup_error (UTL_ScopedName
*n
)
879 if (idl_global
->ignore_lookup_errors_
) return;
880 idl_error_header (EIDL_LOOKUP_ERROR
);
881 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
882 ACE_ERROR ((LM_ERROR
,
887 UTL_Error::lookup_warning (UTL_ScopedName
*n
)
889 if (idl_global
->print_warnings ())
891 idl_warning_header (EIDL_LOOKUP_ERROR
);
892 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
893 ACE_ERROR ((LM_ERROR
, "\n"));
897 // Report an illegal version number assignment.
899 UTL_Error::version_number_error (char *n
)
901 idl_error_header (EIDL_ILLEGAL_VERSION
);
902 ACE_ERROR ((LM_ERROR
,
908 UTL_Error::version_syntax_error (const char *msg
)
910 idl_error_header (EIDL_ILLEGAL_VERSION
);
911 ACE_ERROR ((LM_ERROR
,
916 // Report an attempt to set the version a second time.
918 UTL_Error::version_reset_error ()
920 idl_error_header (EIDL_VERSION_RESET
);
921 ACE_ERROR ((LM_ERROR
,
925 // Report a reset of the id a second time to a different string.
927 UTL_Error::id_reset_error (const char *o
,
930 idl_error_header (EIDL_ID_RESET
);
931 ACE_ERROR ((LM_ERROR
,
937 // Report an attempt to inherit from an interface which was only
938 // declared forward but not yet defined.
940 UTL_Error::inheritance_fwd_error (UTL_ScopedName
*n
,
943 idl_error_header (EIDL_INHERIT_FWD_ERROR
, f
);
945 ACE_ERROR ((LM_ERROR
,
947 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
948 ACE_ERROR ((LM_ERROR
,
949 " cannot inherit from forward declared interface "));
952 f
->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
955 ACE_ERROR ((LM_ERROR
,
959 // Report an attempt to inherit from something other than an interface.
961 UTL_Error::inheritance_error (UTL_ScopedName
*n
,
964 idl_error_header (EIDL_CANT_INHERIT
);
965 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
966 ACE_ERROR ((LM_ERROR
,
967 " attempts to inherit from "));
968 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
969 ACE_ERROR ((LM_ERROR
,
973 // Report an attempt to support an interface which was only
974 // declared forward but not yet defined.
976 UTL_Error::supports_fwd_error (UTL_ScopedName
*n
,
979 idl_error_header (EIDL_SUPPORTS_FWD_ERROR
, f
);
980 ACE_ERROR ((LM_ERROR
,
982 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
983 ACE_ERROR ((LM_ERROR
,
984 " cannot support forward declared interface "));
985 f
->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
986 ACE_ERROR ((LM_ERROR
,
990 // Report an attempt to support something other than an interface.
992 UTL_Error::supports_error (UTL_ScopedName
*n
,
995 idl_error_header (EIDL_CANT_SUPPORT
);
996 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
997 ACE_ERROR ((LM_ERROR
,
998 " attempts to support "));
999 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1000 ACE_ERROR ((LM_ERROR
,
1004 // Report illegal inheritance from non-abstract valuetype or interface.
1006 UTL_Error::abstract_inheritance_error (UTL_ScopedName
*v
,
1009 idl_error_header (EIDL_CANT_INHERIT
);
1010 ACE_ERROR ((LM_ERROR
,
1011 " abstract valuetype "));
1012 v
->dump (*ACE_DEFAULT_LOG_STREAM
);
1013 ACE_ERROR ((LM_ERROR
,
1014 " attempts to inherit from nonabstract type: "));
1015 i
->dump (*ACE_DEFAULT_LOG_STREAM
);
1016 ACE_ERROR ((LM_ERROR
,
1020 // Report illegal support of non-abstract interface.
1022 UTL_Error::abstract_support_error (UTL_ScopedName
*v
,
1025 idl_error_header (EIDL_CANT_SUPPORT
);
1026 ACE_ERROR ((LM_ERROR
,
1028 v
->dump (*ACE_DEFAULT_LOG_STREAM
);
1029 ACE_ERROR ((LM_ERROR
,
1030 " attempts to support more than one concrete type: "));
1031 i
->dump (*ACE_DEFAULT_LOG_STREAM
);
1032 ACE_ERROR ((LM_ERROR
,
1036 // Report illegal component or home support of local interface.
1038 UTL_Error::unconstrained_interface_expected (UTL_ScopedName
*c
,
1041 idl_error_header (EIDL_CANT_SUPPORT
);
1042 ACE_ERROR ((LM_ERROR
,
1043 " component or home "));
1044 c
->dump (*ACE_DEFAULT_LOG_STREAM
);
1045 ACE_ERROR ((LM_ERROR
,
1046 " attempts to support a local interface: "));
1047 i
->dump (*ACE_DEFAULT_LOG_STREAM
);
1048 ACE_ERROR ((LM_ERROR
,
1053 UTL_Error::concrete_supported_inheritance_error (UTL_ScopedName
*v
,
1056 idl_error_header (EIDL_CANT_SUPPORT
);
1057 ACE_ERROR ((LM_ERROR
,
1059 v
->dump (*ACE_DEFAULT_LOG_STREAM
);
1060 ACE_ERROR ((LM_ERROR
,
1061 " supports concrete interface that does not inherit from"
1062 " all ancestors of valuetype's ancestor's concrete supported"
1064 i
->dump (*ACE_DEFAULT_LOG_STREAM
);
1065 ACE_ERROR ((LM_ERROR
,
1069 // Report an error while evaluating an expression.
1071 UTL_Error::eval_error (AST_Expression
*v
)
1073 idl_error_header (EIDL_EVAL_ERROR
,
1075 v
->file_name ()->get_string ());
1076 v
->dump (*ACE_DEFAULT_LOG_STREAM
);
1077 ACE_ERROR ((LM_ERROR
,
1081 // Report an error while evaluating an expression.
1083 UTL_Error::incompatible_type_error (AST_Expression
*v
)
1085 idl_error_header (EIDL_INCOMPATIBLE_TYPE
);
1086 v
->dump (*ACE_DEFAULT_LOG_STREAM
);
1087 ACE_ERROR ((LM_ERROR
,
1092 UTL_Error::incompatible_disc_error (AST_Decl
*d
,
1095 idl_error_header (EIDL_LABEL_TYPE
);
1096 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1097 ACE_ERROR ((LM_ERROR
, " does not contain "));
1098 UTL_ScopedName
*sn
= e
->n ();
1100 ? sn
->dump (*ACE_DEFAULT_LOG_STREAM
)
1101 : e
->dump (*ACE_DEFAULT_LOG_STREAM
));
1102 ACE_ERROR ((LM_ERROR
, "\n"));
1105 // Report a situation where a constant was expected but we
1106 // got something else. This may occur in a union when a label
1107 // evaluates to a non-constant.
1109 UTL_Error::constant_expected (UTL_ScopedName
*n
,
1112 idl_error_header (EIDL_CONSTANT_EXPECTED
, d
);
1113 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
1114 ACE_ERROR ((LM_ERROR
,
1116 d
->dump (*ACE_DEFAULT_LOG_STREAM
);
1117 ACE_ERROR ((LM_ERROR
,
1121 // Report a situation where an interface was expected but we got
1122 // something else instead. This most likely is a case in a supports
1123 // or inheritance list.
1125 UTL_Error::interface_expected (AST_Decl
*d
)
1127 idl_error_header (EIDL_INTERFACE_EXPECTED
);
1128 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1129 ACE_ERROR ((LM_ERROR
,
1134 UTL_Error::template_module_expected (AST_Decl
*d
)
1136 idl_error_header (EIDL_TMPL_MODULE_EXPECTED
);
1137 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1138 ACE_ERROR ((LM_ERROR
,
1142 // Report a situation where an value type was expected but we got
1143 // something else instead. This most likely is a case in a primary
1144 // key, emits, publishes or consumes declaration.
1146 UTL_Error::valuetype_expected (AST_Decl
*d
)
1148 idl_error_header (EIDL_VALUETYPE_EXPECTED
);
1149 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1150 ACE_ERROR ((LM_ERROR
,
1154 // Report a situation where a concrete value type was expected but we got
1155 // something else instead. This most likely is a case where a valuetype
1156 // inherits from something other than a concrete valuetype.
1158 UTL_Error::concrete_valuetype_expected (AST_Decl
*d
)
1160 idl_error_header (EIDL_CONCRETE_VT_EXPECTED
);
1161 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1162 ACE_ERROR ((LM_ERROR
,
1166 // Report a situation where an abstract type was expected but we got
1167 // something else instead. This is the case in an inheritance
1168 // list where a concrete type appears after an abstract type, or
1169 // where a valuetype inherits more than one concrete valuetype.
1171 UTL_Error::abstract_expected (AST_Decl
*d
)
1173 idl_error_header (EIDL_ABSTRACT_EXPECTED
);
1174 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1175 ACE_ERROR ((LM_ERROR
,
1179 // Report a situation where an abstract type was expected but we got
1180 // something else instead. This is the case in an inheritance
1181 // list where a concrete type appears after an abstract type, or
1182 // where a valuetype inherits more than one concrete valuetype.
1184 UTL_Error::eventtype_expected (AST_Decl
*d
)
1186 idl_error_header (EIDL_EVENTTYPE_EXPECTED
);
1187 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1188 ACE_ERROR ((LM_ERROR
,
1192 // Report a situation where a valuetype used as a primary key for a
1193 // component home does not inherit directly or indirectly from
1194 // Components::primaryKeyBase.
1196 UTL_Error::primary_key_error (AST_Decl
*d
)
1198 idl_error_header (EIDL_PRIMARY_KEY_ERROR
);
1199 ACE_ERROR ((LM_ERROR
,
1201 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1202 ACE_ERROR ((LM_ERROR
,
1203 "does not have Components::primaryKeyBase as an ancestor\n"));
1206 // Report a situation where an enumerator was expected but we
1207 // got something else. This may occur in a union with an enum
1208 // discriminator where a label did not evaluate to a constant
1211 UTL_Error::enum_val_expected (AST_Union
*u
,
1214 idl_error_header (EIDL_ENUM_VAL_EXPECTED
, u
);
1215 ACE_ERROR ((LM_ERROR
,
1217 u
->local_name ()->get_string ()));
1218 l
->dump (*ACE_DEFAULT_LOG_STREAM
);
1219 ACE_ERROR ((LM_ERROR
,
1223 // Report a situation where an enumerator was received but we
1224 // could not find it (by name) in an enum. This occurs when
1225 // a union with an enum discriminator is being parsed, and a
1226 // label evaluates to an enumerator which is not a member of
1227 // the enum discriminator type.
1229 UTL_Error::enum_val_lookup_failure (AST_Union
*u
,
1233 idl_error_header (EIDL_ENUM_VAL_NOT_FOUND
, u
);
1234 ACE_ERROR ((LM_ERROR
,
1235 " union %C, enum %C, enumerator ",
1236 u
->local_name ()->get_string (),
1237 e
->local_name ()->get_string ()));
1238 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
1239 ACE_ERROR ((LM_ERROR
,
1243 // Report clash between declared and referenced indentifiers.
1245 UTL_Error::redef_error (const char *b
, const char *n
)
1247 idl_error_header (EIDL_REDEF
);
1248 ACE_ERROR ((LM_ERROR
,
1249 "\"%s\" and \"%s\"\n",
1254 // Report two or more spellings for an identifier.
1256 UTL_Error::name_case_error (char *b
, char *n
)
1258 idl_error_header (EIDL_NAME_CASE_ERROR
);
1259 ACE_ERROR ((LM_ERROR
,
1260 "\"%C\" and \"%C\"\n",
1266 UTL_Error::name_case_warning (char *b
,
1269 if (idl_global
->print_warnings ())
1271 idl_warning_header (EIDL_NAME_CASE_WARNING
);
1272 ACE_ERROR ((LM_WARNING
,
1273 "\"%C\" and \"%C\"\n",
1280 UTL_Error::idl_keyword_error (char *n
)
1282 idl_error_header (EIDL_KEYWORD_ERROR
);
1283 ACE_ERROR ((LM_ERROR
,
1289 UTL_Error::idl_keyword_warning (char *n
)
1291 if (idl_global
->print_warnings ())
1293 idl_warning_header (EIDL_KEYWORD_WARNING
);
1294 ACE_ERROR ((LM_ERROR
,
1300 // Report an ambiguous definition of a name.
1302 UTL_Error::ambiguous (UTL_Scope
*s
,
1306 idl_error_header (EIDL_AMBIGUOUS
, d
);
1307 ACE_ERROR ((LM_ERROR
,
1308 " scope: %C, collision: ",
1309 (ScopeAsDecl (s
))->local_name ()->get_string ()));
1310 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1311 ACE_ERROR ((LM_ERROR
,
1313 l
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1314 ACE_ERROR ((LM_ERROR
,
1318 // Report a forward declared struct or union which was never defined.
1320 UTL_Error::fwd_decl_not_defined (AST_Type
*d
)
1322 idl_error_header (EIDL_DECL_NOT_DEFINED
, d
);
1323 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1324 ACE_ERROR ((LM_ERROR
,
1328 // Report lookup in undefined forward declared but undefined interface.
1330 UTL_Error::fwd_decl_lookup (AST_Interface
*d
,
1333 idl_error_header (EIDL_FWD_DECL_LOOKUP
);
1334 ACE_ERROR ((LM_ERROR
,
1335 "trying to look up "));
1336 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
1337 ACE_ERROR ((LM_ERROR
,
1338 " in undefined forward declared interface "));
1339 d
->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1340 ACE_ERROR ((LM_ERROR
,
1344 // Report a redefinition inside its own scope.
1346 UTL_Error::redefinition_in_scope (AST_Decl
*d
,
1349 idl_error_header (EIDL_REDEF_SCOPE
, d
);
1350 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1351 ACE_ERROR ((LM_ERROR
,
1353 s
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1354 ACE_ERROR ((LM_ERROR
,
1358 // Report not a type error.
1360 UTL_Error::not_a_type (AST_Decl
*d
)
1362 idl_error_header (EIDL_NOT_A_TYPE
);
1363 if (d
== nullptr || d
->name () == nullptr)
1365 ACE_ERROR ((LM_ERROR
,
1370 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1373 ACE_ERROR ((LM_ERROR
,
1378 UTL_Error::fixed_unsupported (AST_Fixed
*d
)
1380 idl_error_header (EIDL_FIXED_UNSUPPORTED
, d
);
1381 ACE_ERROR ((LM_ERROR
, "\n"));
1385 UTL_Error::back_end (long lineno
,
1388 idl_error_header (EIDL_BACK_END
,
1391 ACE_ERROR ((LM_ERROR
,
1396 UTL_Error::illegal_infix ()
1398 idl_error_header (EIDL_ILLEGAL_INFIX
);
1399 ACE_ERROR ((LM_ERROR
,
1404 UTL_Error::local_remote_mismatch (AST_Decl
*l
,
1407 AST_Decl
*r
= ScopeAsDecl (s
);
1408 idl_error_header (EIDL_LOCAL_REMOTE_MISMATCH
, r
);
1409 ACE_ERROR ((LM_ERROR
,
1411 l
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1412 ACE_ERROR ((LM_ERROR
,
1413 " used in remote operation "));
1414 r
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1415 ACE_ERROR ((LM_ERROR
,
1420 UTL_Error::ignore_idl3_error (AST_Decl
*d
)
1422 idl_error_header (EIDL_IGNORE_IDL3_ERROR
, d
);
1423 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1424 ACE_ERROR ((LM_ERROR
,
1429 UTL_Error::illegal_primary_key (AST_Decl
*d
)
1431 idl_error_header (EIDL_ILLEGAL_PRIMARY_KEY
, d
);
1432 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1433 ACE_ERROR ((LM_ERROR
, "\n"));
1437 UTL_Error::duplicate_param_id (UTL_ScopedName
*n
)
1439 idl_error_header (EIDL_DUPLICATE_T_PARAM
);
1440 ACE_ERROR ((LM_ERROR
, " - "));
1441 n
->dump (*ACE_DEFAULT_LOG_STREAM
);
1442 ACE_ERROR ((LM_ERROR
, "\n"));
1446 UTL_Error::mismatched_template_param (const char *name
)
1448 idl_error_header (EIDL_MISMATCHED_T_PARAM
);
1449 ACE_ERROR ((LM_ERROR
, " - %s\n", name
));
1453 UTL_Error::mismatch_seq_of_param (const char *param_id
)
1455 idl_error_header (EIDL_MISMATCHED_SEQ_PARAM
);
1456 ACE_ERROR ((LM_ERROR
, " - %s\n", param_id
));
1460 UTL_Error::scope_masking_error (AST_Decl
*masked
,
1463 const char *this_file
= idl_global
->filename ()->get_string ();
1464 const char *masked_file
= masked
->file_name ().c_str ();
1465 const char *masking_file
= masking
->file_name ().c_str ();
1467 idl_error_header (EIDL_MISC
);
1468 ACE_ERROR ((LM_ERROR
,
1469 ACE_TEXT ("Did you mean \"::%C\"\n")
1470 ACE_TEXT (" declared at "),
1471 masked
->full_name () ));
1473 const bool same_file
=
1474 (0 == ACE_OS::strcmp (this_file
, masked_file
));
1478 ACE_ERROR ((LM_ERROR
,
1483 ACE_ERROR ((LM_ERROR
,
1484 ACE_TEXT ("line %d but hidden by local \""),
1487 ACE_ERROR ((LM_ERROR
,
1488 ACE_TEXT ("::%C\""),
1489 masking
->full_name ()));
1491 const bool same_file_again
=
1493 && 0 == ACE_OS::strcmp (this_file
, masking_file
));
1495 if (!same_file_again
)
1497 ACE_ERROR ((LM_ERROR
,
1499 ACE_TEXT (" declared at %C "),
1504 ACE_ERROR ((LM_ERROR
,
1505 ACE_TEXT (" at ")));
1508 ACE_ERROR ((LM_ERROR
,
1509 ACE_TEXT ("line %d ?\n"),
1510 masking
->line () ));
1514 UTL_Error::anonymous_type_diagnostic ()
1516 if (idl_global
->anon_silent () || idl_global
->in_typedef ())
1521 if (idl_global
->anon_warning ())
1523 if (idl_global
->print_warnings ())
1525 idl_warning_header (EIDL_ANONYMOUS_WARNING
);
1526 ACE_ERROR ((LM_WARNING
, "\n"));
1531 idl_error_header (idl_global
->explicit_anon_type_diagnostic () ?
1532 EIDL_ANONYMOUS_EXPLICIT_ERROR
: EIDL_ANONYMOUS_ERROR
);
1533 ACE_ERROR ((LM_ERROR
, "\n"));
1538 UTL_Error::template_scope_ref_not_aliased (AST_Decl
*d
)
1540 idl_error_header (EIDL_TEMPLATE_NOT_ALIASED
, d
);
1541 ACE_ERROR ((LM_ERROR
, " - "));
1542 d
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1543 ACE_ERROR ((LM_ERROR
, "\n"));
1547 UTL_Error::idl_version_error (const char *reason
)
1549 idl_error_header (EIDL_IDL_VERSION_ERROR
);
1550 ACE_ERROR ((LM_ERROR
,
1551 ACE_TEXT ("\n%C\nCurrent IDL version is %C, use --idl-version VERSION to ")
1552 ACE_TEXT ("set the IDL version to use.\n"),
1553 reason
, idl_global
->idl_version_
.to_string ()
1558 UTL_Error::unsupported_error (const char *reason
)
1560 idl_error_header (EIDL_UNSUPPORTED
);
1561 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("%C\n"), reason
));
1565 UTL_Error::unsupported_warning (const char *reason
)
1567 if (idl_global
->print_warnings ())
1569 idl_warning_header (EIDL_UNSUPPORTED
);
1570 ACE_ERROR ((LM_WARNING
, ACE_TEXT ("%C\n"), reason
));
1575 UTL_Error::misc_error (const char *reason
, AST_Decl
*node
)
1577 idl_error_header (EIDL_MISC
, node
);
1578 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("%C\n"), reason
));
1582 UTL_Error::misc_warning (const char *reason
, AST_Decl
*node
)
1584 if (idl_global
->print_warnings ())
1586 idl_warning_header (EIDL_MISC
, node
);
1587 ACE_ERROR ((LM_WARNING
, ACE_TEXT ("%C\n"), reason
));
1592 UTL_Error::invalid_annotation_param_error (
1593 AST_Annotation_Appl
*appl
, AST_Annotation_Decl
*decl
,
1594 Identifier
*invalid_id
)
1596 bool is_builtin
= decl
->builtin ();
1597 idl_error_header (EIDL_ANNOTATION_PARAM_ERROR
,
1598 static_cast<AST_Decl
*>(appl
));
1599 invalid_id
->dump (*ACE_DEFAULT_LOG_STREAM
);
1600 ACE_ERROR ((LM_ERROR
, ACE_TEXT (" is not a member of %Cannotation "),
1601 is_builtin
? "builtin " : ""));
1602 decl
->name ()->dump (*ACE_DEFAULT_LOG_STREAM
);
1605 ACE_ERROR ((LM_ERROR
, ACE_TEXT (" declared in \"%C\" on line %d"),
1606 get_filename (decl
), get_lineno (decl
)));
1608 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("\n")));
1612 UTL_Error::invalid_annotation_param_type (
1613 AST_Annotation_Appl
*appl
, AST_Annotation_Member
*member
,
1614 AST_Expression
*offending_value
)
1616 bool is_builtin
= member
->builtin ();
1617 idl_error_header (EIDL_ANNOTATION_PARAM_ERROR
,
1618 static_cast<AST_Decl
*>(appl
));
1619 ACE_ERROR ((LM_ERROR
,
1620 ACE_TEXT ("%Cnnotation member \""),
1621 is_builtin
? "Builtin a" : "A"));
1622 member
->dump (*ACE_DEFAULT_LOG_STREAM
);
1623 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("\"")));
1626 ACE_ERROR ((LM_ERROR
,
1627 ACE_TEXT (" declared in \"%C\" on line %d"),
1628 get_filename (member
), get_lineno (member
)));
1630 ACE_ERROR ((LM_ERROR
, ACE_TEXT (" can not be set to ")));
1631 offending_value
->dump (*ACE_DEFAULT_LOG_STREAM
);
1632 ACE_ERROR ((LM_ERROR
, ACE_TEXT (" because the types are incompatible!\n")));
1636 UTL_Error::annotation_param_missing_error (
1637 AST_Annotation_Appl
*appl
, AST_Annotation_Member
*member
)
1639 bool is_builtin
= member
->builtin ();
1640 idl_error_header (EIDL_ANNOTATION_PARAM_ERROR
,
1641 static_cast<AST_Decl
*>(appl
));
1642 ACE_ERROR ((LM_ERROR
,
1643 ACE_TEXT ("%Cnnotation member: \""),
1644 is_builtin
? "Builtin a" : "A"));
1645 member
->dump (*ACE_DEFAULT_LOG_STREAM
);
1646 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("\"")));
1649 ACE_ERROR ((LM_ERROR
,
1650 ACE_TEXT (" declared in \"%C\" on line %d"),
1651 get_filename (member
), get_lineno (member
)));
1653 ACE_ERROR ((LM_ERROR
,
1654 ACE_TEXT (" needs to be defined because it does not have a default value!\n"),
1655 get_filename (member
), get_lineno (member
)));
1659 UTL_Error::direct_error (
1660 const char *reason
, const ACE_CString
&filename
, long lineno
, UTL_Error::ErrorCode error_code
)
1662 idl_error_header (error_code
, lineno
, filename
);
1663 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("%C\n"), reason
));
1667 UTL_Error::direct_warning (
1668 const char *reason
, const ACE_CString
&filename
, long lineno
, UTL_Error::ErrorCode error_code
)
1670 if (idl_global
->print_warnings ())
1672 idl_warning_header (error_code
, lineno
, filename
);
1673 ACE_ERROR ((LM_WARNING
, ACE_TEXT ("%C\n"), reason
));
1677 void UTL_Error::reset_last_error_and_warning ()
1679 last_error
= EIDL_OK
;
1680 last_error_lineno
= -1;
1681 last_warning
= EIDL_OK
;
1682 last_warning_lineno
= -1;