Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323445

Summary: Generate cross linked message for redeclaration xlc error
Product: [Tools] CDT Reporter: Olexiy Buyanskyy <olexiyb>
Component: cdt-buildAssignee: Andrew Gvozdev <angvoz.dev>
Status: RESOLVED FIXED QA Contact: Andrew Gvozdev <angvoz.dev>
Severity: normal    
Priority: P3    
Version: 8.0   
Target Milestone: 8.0   
Hardware: PC   
OS: All   
Whiteboard:

Description Olexiy Buyanskyy CLA 2010-08-23 17:31:50 EDT
xlc gives an error if there are several declarations of the same function

"src/com/lowes/ss/sos/reqProject/reqProjectB.c", line 403.12: 1506-343 (S) Redeclaration of checkForAssocProj differs from previous declaration on line 306 of "src/com/lowes/ss/sos/reqProject/reqProject.h".

I propose to generate opposite error message for second location

"src/com/lowes/ss/sos/reqProject/reqProject.h", line 306: 1506-343 (S) Redeclaration of checkForAssocProj differs from another declaration on line 403 of "src/com/lowes/ss/sos/reqProject/reqProjectB.c"

There is similar task for macros bug 321160
Comment 1 Andrew Gvozdev CLA 2010-09-24 18:19:00 EDT
The fix committed to the HEAD (8.0)
Comment 3 Andrew Gvozdev CLA 2010-09-24 18:26:26 EDT
Olexiy, please verify if it is working OK. I am marking the first declaration with "Info" marker because it is not an error yet. It is an error to declare second time.
Comment 4 Olexiy Buyanskyy CLA 2010-09-28 12:05:46 EDT
I think both messages has to be in the same Error group.
In that case user will be able to see both messages together in Problem view and see error icon on file with different definition.
This feature has to bring attention of programmer to particular files those have errors.

I also propose to ignore meanless xlc info that is generated next to error message

"src/com/lowes/ss/sos/reqProject/reqProjectB.c", line 2541.5: 1506-376 (I) Redeclaration of checkForAssocProj has a different number of fixed parameters than the previous declaration.
Comment 5 Andrew Gvozdev CLA 2010-09-30 09:55:31 EDT
Let me take another look.
Comment 6 Andrew Gvozdev CLA 2010-09-30 12:11:01 EDT
(In reply to comment #4)
> I think both messages has to be in the same Error group.
> In that case user will be able to see both messages together in Problem view and
> see error icon on file with different definition.
> This feature has to bring attention of programmer to particular files those have
> errors.
Okay, I suppose it would be more useful this way.

> I also propose to ignore meanless xlc info that is generated next to error
> message
> "src/com/lowes/ss/sos/reqProject/reqProjectB.c", line 2541.5: 1506-376 (I)
> Redeclaration of checkForAssocProj has a different number of fixed parameters
> than the previous declaration.
It's a daunting task to hunt after all possible warnings, I don't think it is feasible. I don't know how many others are out there. Consider:
"test.c", line 4.6: 1506-302 (I) The declarations of the function fun must be consistent in their use of the ellipsis.
"test.c", line 4.6: 1506-377 (I) The type "int" of parameter 1 differs from the previous type "int*".

Besides, from practical point of view, it happens that the presence of the Info marker lets you navigate between both files in the Console view using "Next Error" buttons. Otherwise the "Redeclaration" line is associated with the error in one file only (the first marker).