~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to results/plugins/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IProblem.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************************
2
 
 *  Copyright (c) 2000, 2009 IBM Corporation and others.
3
 
 *  All rights reserved. This program and the accompanying materials
4
 
 *  are made available under the terms of the Eclipse Public License v1.0
5
 
 *  which accompanies this distribution, and is available at
6
 
 *  http://www.eclipse.org/legal/epl-v10.html
7
 
 * 
8
 
 *  Contributors:
9
 
 *     IBM Corporation - initial API and implementation
10
 
 *******************************************************************************/
11
 
package org.eclipse.cdt.core.parser;
12
 
 
13
 
import org.eclipse.cdt.internal.core.parser.ParserMessages;
14
 
 
15
 
/**
16
 
 * @author jcamelon
17
 
 *
18
 
 * Description of a C/C++ parse/compilation problem, as detected by the parser or some of the underlying
19
 
 * clients of the parser. 
20
 
 * 
21
 
 * A problem provides access to:
22
 
 * <ul>
23
 
 * <li> its location (originating source file name, source position, line number), </li>
24
 
 * <li> its message description and a predicate to check its severity (warning or error). </li>
25
 
 * <li> its ID : an number identifying the very nature of this problem. All possible IDs are listed
26
 
 * as constants on this interface. </li>
27
 
 * </ul>
28
 
 * 
29
 
 * @noimplement This interface is not intended to be implemented by clients.
30
 
 * @noextend This interface is not intended to be extended by clients.
31
 
 */
32
 
public interface IProblem
33
 
{
34
 
        /**
35
 
         * Returns the problem id
36
 
         * 
37
 
         * @return the problem id
38
 
         */
39
 
        int getID();
40
 
 
41
 
        /**
42
 
         * Answer a localized, human-readable message string which describes the problem.
43
 
         * 
44
 
         * @return a localized, human-readable message string which describes the problem
45
 
         */
46
 
        String getMessage();
47
 
 
48
 
        /**
49
 
         * Returns a human-readable message string describing the problem, adding
50
 
         * location information.
51
 
         */
52
 
        String getMessageWithLocation();
53
 
 
54
 
        /**
55
 
         * Return to the client a map between parameter names and values.  
56
 
         * 
57
 
         * The keys and values are all Strings.  
58
 
         * 
59
 
         *
60
 
         * @return a map between parameter names and values.
61
 
         */
62
 
        String[] getArguments();
63
 
 
64
 
        /**
65
 
         * Answer the file name in which the problem was found.
66
 
         * 
67
 
         * @return the file name in which the problem was found
68
 
         */
69
 
        char[] getOriginatingFileName();
70
 
 
71
 
        /**
72
 
         * Answer the end position of the problem (inclusive), or -1 if unknown.
73
 
         * 
74
 
         * @return the end position of the problem (inclusive), or -1 if unknown
75
 
         */
76
 
        int getSourceEnd();
77
 
 
78
 
        /**
79
 
         * Answer the line number in source where the problem begins.
80
 
         * 
81
 
         * @return the line number in source where the problem begins, or -1 if unknown
82
 
         */
83
 
        int getSourceLineNumber();
84
 
 
85
 
        /**
86
 
         * Answer the start position of the problem (inclusive), or -1 if unknown.
87
 
         * 
88
 
         * @return the start position of the problem (inclusive), or -1 if unknown
89
 
         */
90
 
        int getSourceStart();
91
 
 
92
 
        /**
93
 
         * Checks the severity to see if the Error bit is set.
94
 
         * 
95
 
         * @return true if the Error bit is set for the severity, false otherwise
96
 
         */
97
 
        boolean isError();
98
 
 
99
 
        /**
100
 
         * Checks the severity to see if the Warning bit is not set.
101
 
         * 
102
 
         * @return true if the Warning bit is not set for the severity, false otherwise
103
 
         */
104
 
        boolean isWarning();
105
 
 
106
 
        /**
107
 
         * Unknown Numeric Value for line numbers and offsets; use this constant
108
 
         */
109
 
        public final static int INT_VALUE_NOT_PROVIDED = -1;
110
 
        
111
 
        /**
112
 
         * Unknown filename sentinel value
113
 
         */
114
 
        public final static String FILENAME_NOT_PROVIDED = ParserMessages.getString("IProblem.unknownFileName"); //$NON-NLS-1$
115
 
 
116
 
        /**
117
 
         * Problem Categories
118
 
         * The high bits of a problem ID contains information about the category of a problem. 
119
 
         * For example, (problemID & TypeRelated) != 0, indicates that this problem is type related.
120
 
         * 
121
 
         * A problem category can help to implement custom problem filters. Indeed, when numerous problems
122
 
         * are listed, focusing on import related problems first might be relevant.
123
 
         * 
124
 
         * When a problem is tagged as Internal, it means that no change other than a local source code change
125
 
         * can  fix the corresponding problem.
126
 
         */
127
 
        
128
 
        /**
129
 
         * IProblem relates to a valid error on the Scanner
130
 
         */
131
 
        public final static int SCANNER_RELATED = 0x01000000;
132
 
        
133
 
        /**
134
 
         * IProblem relates to a valid error on the preprocessor 
135
 
         */
136
 
        public final static int PREPROCESSOR_RELATED = 0x02000000;
137
 
        
138
 
        /**
139
 
         * IProblem relates to a valid syntax error in the parser
140
 
         */
141
 
        public final static int SYNTAX_RELATED = 0x04000000;
142
 
        
143
 
        /**
144
 
         * IProblem relates to a valid semantical error in the parser
145
 
         */
146
 
        public final static int SEMANTICS_RELATED = 0x08000000;
147
 
        
148
 
        /**
149
 
         * IProblem relates to an implementation of design limitation
150
 
         */
151
 
        public final static int INTERNAL_RELATED = 0x10000000;
152
 
 
153
 
 
154
 
        /**
155
 
         * Check the parameter bitmask against an IProblem's ID to broadly segregate the 
156
 
         * types of problems.  
157
 
         * 
158
 
         * @param bitmask
159
 
         * @return true if ( (id & bitmask ) != 0 )
160
 
         */
161
 
        public boolean checkCategory(int bitmask);
162
 
 
163
 
        /**
164
 
         * Mask to use in order to filter out the category portion of the problem ID.
165
 
         */
166
 
        public final static int IGNORE_CATEGORIES_MASK = 0xFFFFFF;
167
 
 
168
 
        /**
169
 
         * Below are listed all available problem attributes.  The JavaDoc for each  problem ID indicates
170
 
         * when they should be contributed to creating a problem of that type.  
171
 
         */
172
 
 
173
 
        // Preprocessor IProblem attributes      
174
 
        /**
175
 
         * The text that follows a #error preprocessor directive 
176
 
         */
177
 
        public final static String A_PREPROC_POUND_ERROR = ParserMessages.getString("IProblem.preproc.poundError"); //$NON-NLS-1$
178
 
        /**
179
 
         * The text that follows a #warning preprocessor directive 
180
 
         */
181
 
        public final static String A_PREPROC_POUND_WARNING = ParserMessages.getString("IProblem.preproc.poundWarning"); //$NON-NLS-1$
182
 
 
183
 
        /**
184
 
         * The filename that failed somehow in an preprocessor include directive
185
 
         */
186
 
        public final static String A_PREPROC_INCLUDE_FILENAME = ParserMessages.getString("IProblem.preproc.include"); //$NON-NLS-1$
187
 
 
188
 
        /**
189
 
         * A preprocessor macro name
190
 
         */
191
 
        public final static String A_PREPROC_MACRO_NAME = ParserMessages.getString("IProblem.preproc.macro"); //$NON-NLS-1$
192
 
 
193
 
        /**
194
 
         * A preprocessor conditional that could not be evaluated
195
 
         * 
196
 
         * #if X + Y == Z       <== that one, if X, Y or Z are not defined 
197
 
         * #endif 
198
 
         */
199
 
        public final static String A_PREPROC_CONDITION = ParserMessages.getString("IProblem.preproc.condition"); //$NON-NLS-1$
200
 
 
201
 
        /**
202
 
         * A preprocessor directive that could not be interpretted
203
 
         * 
204
 
         * e.g.  #blah 
205
 
         */
206
 
        public final static String A_PREPROC_UNKNOWN_DIRECTIVE = ParserMessages.getString("IProblem.preproc.unknownDirective"); //$NON-NLS-1$
207
 
 
208
 
        /**
209
 
         * The preprocessor conditional statement that caused an unbalanced mismatch.  
210
 
         * 
211
 
         * #if X 
212
 
         * #else
213
 
         * #else                <=== that one
214
 
         * #endif 
215
 
         */
216
 
        public final static String A_PREPROC_CONDITIONAL_MISMATCH = ParserMessages.getString("IProblem.preproc.conditionalMismatch"); //$NON-NLS-1$
217
 
 
218
 
        /**
219
 
         * The Bad character encountered in scanner 
220
 
         */
221
 
        public static final String A_SCANNER_BADCHAR = null;
222
 
 
223
 
        /**
224
 
         * A_SYMBOL_NAME  - symbol name 
225
 
         */
226
 
        public static final String A_SYMBOL_NAME = ParserMessages.getString("IProblem.symbolName"); //$NON-NLS-1$
227
 
        
228
 
        /**
229
 
         * A_NAMESPACE_NAME = namespace name
230
 
         */
231
 
        public static final String A_NAMESPACE_NAME = ParserMessages.getString("IProblem.namespaceName"); //$NON-NLS-1$
232
 
        
233
 
        /**
234
 
         * A_TYPE_NAME - type name 
235
 
         */
236
 
        public static final String A_TYPE_NAME = ParserMessages.getString("IProblem.typeName"); //$NON-NLS-1$
237
 
        
238
 
        /**
239
 
         * Below are listed all available problem IDs. Note that this list could be augmented in the future, 
240
 
         * as new features are added to the C/C++ core implementation.
241
 
         */
242
 
 
243
 
        /*
244
 
         * Scanner Problems
245
 
         */
246
 
         
247
 
        /** 
248
 
         * Bad character encountered by Scanner. 
249
 
         * Required attributes: A_SCANNER_BADCHAR
250
 
         * @see #A_SCANNER_BADCHAR  
251
 
         */
252
 
        public final static int SCANNER_BAD_CHARACTER = SCANNER_RELATED | 0x001;
253
 
        
254
 
        /** 
255
 
         * Unbounded literal string encountered by Scanner. 
256
 
         * Required attributes: none.  
257
 
         */
258
 
        public final static int SCANNER_UNBOUNDED_STRING = SCANNER_RELATED | 0x002;
259
 
        
260
 
        /** 
261
 
         * Invalid escape sequence encountered by Scanner. 
262
 
         * Required attributes: none.  
263
 
         */
264
 
        public final static int SCANNER_INVALID_ESCAPECHAR = SCANNER_RELATED | 0x003;
265
 
        
266
 
        /** 
267
 
         * Bad floating point encountered by Scanner. 
268
 
         * Required attributes: none.  
269
 
         */
270
 
        public final static int SCANNER_BAD_FLOATING_POINT = SCANNER_RELATED | 0x004;
271
 
        
272
 
        /** 
273
 
         * Bad hexidecimal encountered by Scanner. 
274
 
         * Required attributes: none.  
275
 
         */
276
 
        public final static int SCANNER_BAD_HEX_FORMAT = SCANNER_RELATED | 0x005;
277
 
        
278
 
        /** 
279
 
         * Unexpected EOF encountered by Scanner.   
280
 
         * Required attributes: none.  
281
 
         */
282
 
        public final static int SCANNER_UNEXPECTED_EOF = SCANNER_RELATED | 0x006;
283
 
        
284
 
        /** 
285
 
         * Bad octal encountered by Scanner. 
286
 
         * Required attributes: none.  
287
 
         */
288
 
        public final static int SCANNER_BAD_OCTAL_FORMAT = SCANNER_RELATED | 0x007;
289
 
 
290
 
        /** 
291
 
         * Bad decimal encountered by Scanner. 
292
 
         * Required attributes: none.  
293
 
         */
294
 
        public final static int SCANNER_BAD_DECIMAL_FORMAT = SCANNER_RELATED | 0x008;
295
 
 
296
 
        /** 
297
 
         * Assignment '=' encountered in macro by Scanner. 
298
 
         * Required attributes: none.  
299
 
         */
300
 
        public final static int SCANNER_ASSIGNMENT_NOT_ALLOWED = SCANNER_RELATED | 0x009;
301
 
 
302
 
        /** 
303
 
         * Division by 0 encountered in macro by Scanner. 
304
 
         * Required attributes: none.  
305
 
         */
306
 
        public final static int SCANNER_DIVIDE_BY_ZERO = SCANNER_RELATED | 0x00A;
307
 
        
308
 
        /** 
309
 
         * Missing ')' encountered in macro by Scanner. 
310
 
         * Required attributes: none.  
311
 
         */
312
 
        public final static int SCANNER_MISSING_R_PAREN = SCANNER_RELATED | 0x00B;      
313
 
 
314
 
        /** 
315
 
         * Expression syntax error encountered in macro by Scanner. 
316
 
         * Required attributes: none.  
317
 
         */
318
 
        public final static int SCANNER_EXPRESSION_SYNTAX_ERROR = SCANNER_RELATED | 0x00C;
319
 
        
320
 
        /** 
321
 
         * Expression syntax error encountered in macro by Scanner. 
322
 
         * Required attributes: none.  
323
 
         */
324
 
        public final static int SCANNER_ILLEGAL_IDENTIFIER = SCANNER_RELATED | 0x00D;
325
 
 
326
 
        /** 
327
 
         * Division by 0 encountered in macro by Scanner. 
328
 
         * Required attributes: none.  
329
 
         */
330
 
        public final static int SCANNER_BAD_CONDITIONAL_EXPRESSION = SCANNER_RELATED | 0x00E;
331
 
        
332
 
        /** 
333
 
         * Bad binary encountered by Scanner. 
334
 
         * Required attributes: none.  
335
 
         * @since 5.1
336
 
         */
337
 
        public final static int SCANNER_BAD_BINARY_FORMAT = SCANNER_RELATED | 0x00F;
338
 
 
339
 
 
340
 
        /*
341
 
         * Preprocessor Problems
342
 
         */
343
 
         
344
 
        /**
345
 
         *      #error encountered by Preprocessor.  
346
 
         * Required attributes:  A_PREPROC_POUND_ERROR
347
 
         * @see #A_PREPROC_POUND_ERROR
348
 
         */
349
 
        public final static int PREPROCESSOR_POUND_ERROR = PREPROCESSOR_RELATED | 0x001;
350
 
        
351
 
        /**
352
 
         *      Inclusion not found by Preprocessor.  
353
 
         * Required attributes: A_PREPROC_INCLUDE_FILENAME
354
 
         * @see #A_PREPROC_INCLUDE_FILENAME
355
 
         */     
356
 
        public final static int PREPROCESSOR_INCLUSION_NOT_FOUND = PREPROCESSOR_RELATED | 0x002;
357
 
        
358
 
        /**
359
 
         *      Macro definition not found by Preprocessor.  
360
 
         * Required attributes:  A_PREPROC_MACRO_NAME
361
 
         * @see #A_PREPROC_MACRO_NAME
362
 
         */ 
363
 
        public final static int PREPROCESSOR_DEFINITION_NOT_FOUND = PREPROCESSOR_RELATED | 0x003;
364
 
        
365
 
        /**
366
 
         *      Preprocessor conditionals seem unbalanced.  
367
 
         * Required attributes:  A_PREPROC_CONDITIONAL_MISMATCH
368
 
         * @see #A_PREPROC_CONDITIONAL_MISMATCH
369
 
         */
370
 
        
371
 
        public final static int PREPROCESSOR_UNBALANCE_CONDITION = PREPROCESSOR_RELATED | 0x004;
372
 
        
373
 
        /**
374
 
         *      Invalid format to Macro definition.    
375
 
         * Required attributes:  A_PREPROC_MACRO_NAME
376
 
         * @see #A_PREPROC_MACRO_NAME
377
 
         */     
378
 
        public final static int PREPROCESSOR_INVALID_MACRO_DEFN = PREPROCESSOR_RELATED | 0x005;
379
 
        
380
 
        /**
381
 
         *      Invalid or unknown preprocessor directive encountered by Preprocessor.  
382
 
         * Required attributes: A_PREPROC_UNKNOWN_DIRECTIVE
383
 
         * @see #A_PREPROC_UNKNOWN_DIRECTIVE
384
 
         */     
385
 
        public final static int PREPROCESSOR_INVALID_DIRECTIVE = PREPROCESSOR_RELATED | 0x006;
386
 
        
387
 
        /**
388
 
         *      Invalid macro redefinition encountered by Preprocessor.    
389
 
         * Required attributes: A_PREPROC_MACRO_NAME
390
 
         * @see #A_PREPROC_MACRO_NAME
391
 
         */     
392
 
        public final static int PREPROCESSOR_INVALID_MACRO_REDEFN = PREPROCESSOR_RELATED | 0x007;
393
 
        
394
 
        /**
395
 
         *      Preprocessor Conditional cannot not be evaluated due.    
396
 
         * Required attributes: A_PREPROC_CONDITION
397
 
         * @see #A_PREPROC_CONDITION
398
 
         */     
399
 
        public final static int PREPROCESSOR_CONDITIONAL_EVAL_ERROR = PREPROCESSOR_RELATED | 0x008;
400
 
        
401
 
        /**
402
 
         * Invalid macro usage encountered by Preprocessor.  
403
 
         * Required attributes: A_PREPROC_MACRO_NAME
404
 
         * @see #A_PREPROC_MACRO_NAME
405
 
         */     
406
 
        public final static int PREPROCESSOR_MACRO_USAGE_ERROR = PREPROCESSOR_RELATED | 0x009;
407
 
        
408
 
        /**
409
 
         * Invalid Macro Pasting encountered by Preprocessor. 
410
 
         * Required attributes: A_PREPROC_MACRO_NAME
411
 
         * @see #A_PREPROC_MACRO_NAME
412
 
         */
413
 
        public final static int PREPROCESSOR_MACRO_PASTING_ERROR = PREPROCESSOR_RELATED | 0x00A;
414
 
        
415
 
        /**
416
 
         * Circular inclusion encountered by Preprocessor.  
417
 
         * Required attributes: A_PREPROC_INCLUDE_FILENAME
418
 
         * @see #A_PREPROC_INCLUDE_FILENAME
419
 
         */     
420
 
        public final static int PREPROCESSOR_CIRCULAR_INCLUSION = PREPROCESSOR_RELATED | 0x00B;
421
 
        
422
 
        /**
423
 
         * macro argument "..." encountered without the required ')' i.e. must be last argument if used  
424
 
         * Required attributes: none
425
 
         */     
426
 
        public final static int PREPROCESSOR_MISSING_RPAREN_PARMLIST = PREPROCESSOR_RELATED | 0x00C;    
427
 
 
428
 
        /**
429
 
         * __VA_ARGS__ encountered in macro definition without the required '...' parameter  
430
 
         * Required attributes: none
431
 
         */     
432
 
        public final static int PREPROCESSOR_INVALID_VA_ARGS = PREPROCESSOR_RELATED | 0x00D;
433
 
        
434
 
        /**
435
 
         * #warning encountered by Preprocessor.  
436
 
         * Required attributes:  A_PREPROC_POUND_WARNING
437
 
         * @see #A_PREPROC_POUND_WARNING
438
 
         */
439
 
        public final static int PREPROCESSOR_POUND_WARNING = PREPROCESSOR_RELATED | 0x00E;
440
 
        
441
 
        /*
442
 
         * Parser Syntactic Problems
443
 
         */
444
 
        public final static int SYNTAX_ERROR = SYNTAX_RELATED | 0x001;
445
 
 
446
 
        /*
447
 
         * Parser Semantic Problems
448
 
         */
449
 
        
450
 
        /**
451
 
         * Attempt to add a unique symbol, yet the value was already defined.
452
 
         * Require attributes: A_SYMBOL_NAME
453
 
         * @see #A_SYMBOL_NAME  
454
 
         */
455
 
        public final static int SEMANTIC_UNIQUE_NAME_PREDEFINED = SEMANTICS_RELATED | 0x001;
456
 
        
457
 
        /**
458
 
         * Attempt to use a symbol that was not found. 
459
 
         * Require attributes: A_SYMBOL_NAME
460
 
         * @see #A_SYMBOL_NAME  
461
 
         */     
462
 
        public final static int SEMANTIC_NAME_NOT_FOUND = SEMANTICS_RELATED | 0x002;
463
 
 
464
 
        /**
465
 
         * Name not provided in context that it was required.   
466
 
         * Require attributes: none
467
 
         */
468
 
        public final static int SEMANTIC_NAME_NOT_PROVIDED = SEMANTICS_RELATED | 0x003;
469
 
 
470
 
        /**
471
 
         * Invalid overload of a particular name.
472
 
         * Required attributes: A_SYMBOL_NAME
473
 
         * @see #A_SYMBOL_NAME  
474
 
         */
475
 
        public static final int SEMANTIC_INVALID_OVERLOAD = SEMANTICS_RELATED | 0x004;
476
 
 
477
 
        /**
478
 
         * Invalid using directive.  
479
 
         * Required attributes: A_NAMESPACE_NAME
480
 
         * @see #A_NAMESPACE_NAME
481
 
         */
482
 
        public static final int SEMANTIC_INVALID_USING = SEMANTICS_RELATED | 0x005;
483
 
        
484
 
        /**
485
 
         * Ambiguous lookup for given name. 
486
 
         * Required attributes: A_SYMBOL_NAME
487
 
         * @see #A_SYMBOL_NAME
488
 
         */
489
 
        public static final int SEMANTIC_AMBIGUOUS_LOOKUP = SEMANTICS_RELATED | 0x006;
490
 
 
491
 
        /**
492
 
         * Invalid type provided
493
 
         * Required attributes: A_TYPE_NAME
494
 
         * @see #A_TYPE_NAME
495
 
         */
496
 
        public static final int SEMANTIC_INVALID_TYPE = SEMANTICS_RELATED | 0x007;
497
 
 
498
 
        public static final int SEMANTIC_CIRCULAR_INHERITANCE = SEMANTICS_RELATED | 0x008;
499
 
 
500
 
        public static final int SEMANTIC_INVALID_TEMPLATE = SEMANTICS_RELATED | 0x009;
501
 
 
502
 
        public static final int SEMANTIC_BAD_VISIBILITY = SEMANTICS_RELATED | 0x00A;
503
 
 
504
 
        public static final int SEMANTIC_UNABLE_TO_RESOLVE_FUNCTION = SEMANTICS_RELATED | 0x00B;
505
 
 
506
 
        public static final int SEMANTIC_INVALID_TEMPLATE_ARGUMENT = SEMANTICS_RELATED | 0x00C;
507
 
 
508
 
        public static final int SEMANTIC_INVALID_TEMPLATE_PARAMETER = SEMANTICS_RELATED | 0x00D;
509
 
 
510
 
        public static final int SEMANTIC_REDECLARED_TEMPLATE_PARAMETER = SEMANTICS_RELATED | 0x00E;
511
 
 
512
 
        public static final int SEMANTIC_INVALID_CONVERSION_TYPE = SEMANTICS_RELATED | 0x00F;
513
 
 
514
 
        public static final int SEMANTIC_MALFORMED_EXPRESSION = SEMANTICS_RELATED | 0x010;
515
 
 
516
 
        public static final int SEMANTIC_ILLFORMED_FRIEND = SEMANTICS_RELATED | 0x011;
517
 
        
518
 
        public static final int SEMANTIC_RECURSIVE_TEMPLATE_INSTANTIATION = SEMANTICS_RELATED | 0x012;
519
 
}