This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC Error Codes


Two comments:

1) What if the same warning or error message comes from two places? Your numbering system would make this hard to identify. I would suggest gathering up all the errors and warnings from all the files, remove duplicates, then proceed with the numbering. Or... it may be that in the process of removing duplicates it is found that a message used in two places may be better if it was different because the examples or explanation could be more exact.

2) AIX (yea, I know thats a ick term) attempts to have a consistent numbering system across the whole platform. This is done by splitting the number into two pieces: aaaa-bbbbbb: where aaaa is assigned to a particular program and bbbbbbb is the unique number within the program (as you described). Perhaps the aaaa part is what you intended for the 'c' in your example below. I would make it more explicit. e.g. gcc1001 at least.

I don't know how GNU does internationalization. But in AIX-land, this is the first step. The messages are in the code and also in a message file. If no language is specified in the user's environment, the message in the code is used. If a language is specified (I'm talking about the user's spoken language), then the message is looked up in a file based upon the LANG and NLS environment variables.

My warning is that this triggers a somewhat substantial support effort. As new messages are added, their translations should be created and added to each language file.

With all that aside, as a user of gcc, I think it is a great idea -- especially if it crept over into all of GNU's products.

On Jan 15, 2006, at 4:59 AM, rubicant rubicant wrote:

I'm trying to suggest that GCC should have error codes to describe
errors, continue reading on if you like the idea or not ;-)

THE IDEA:
The idea is to make GCC better when it comes to error reporting. This
will be done using so called error codes which then can be looked up
in a properly
formatted document to see what the error means when in confusion. This
will save time when it comes to searching what a error means around
and improve usability.

ERROR CODE FORMAT:

The way errors are shown is as follow:

for example instead of:
"ISO C forbids specifying range of elements to initialize"

you get:
"c742: ISO C forbids specifying range of elements to initialize"

Note that this error code is random i want to avoid this by a
numbering system as follows:

The numbering starts from x100 and goes on from there, there will be
no particular error code pattern because its to late for that rather
it will
start with warning() in alphabetic order of the source file names.

so in a file called aaa.c the first warning will be x100 and then the
second warning x101 until all warnings are numbered the next source
file gets numbered.

The order is:
warning()
error()
pedwarn()
(and pedwarn_c99())

From there on if warning or errors are added the numbering goes up so
it wont be arranged anymore.
The `x' prefix will indicate what language for C++ specif
errors/warning it should differ from the C prefix.

ERROR CODE DOCUMENT:

To document error codes there needs to a be a format. It will look
very familiar for those who have been reading/making man pages as well
;-)

These are the sections:

*ERROR Code of the error.
*DESCRIPTION Describe the error.
*EXAMPLES Show a pseudo-code example on how you should not do it
but how to do it instead. (if needed)
*SEE ALSO Show error codes that looks similar.
*SUPPORT If the document is not complete ask for help.
*DISCLAIMER Explain that it is provided ``as is''


Note: DISCLAIMER should be the same in all error code documents.

PROBLEMS:

1.) Its almost impossible to let this feature being enabeld/disabled
using compiler flags.
2.) The amount of warnings, errors and pedantic warnings is so high it
will take a _lot_ of time to complete.
3.) This wont stop, feature code that's uses functions like pedwarn()
needs to follow guid-lines or it needs to be maintained.
5.) There are people who are going scream that its a lame idea.

NOTE:

This "draft" is meant to give you a view on what the idea is there are
probably errors in it. Please don't take this as a insult or something
because it's a idea to improve GCC to my opinion. If you don't agree
then please say so and why! And suggestions are welcome ;-)

-- Rubicant Rubicant



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]