Bug 533259 - Symbol could not be resolved when defined as both variable and function
Summary: Symbol could not be resolved when defined as both variable and function
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 9.4.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on: 337583
Blocks:
  Show dependency tree
 
Reported: 2018-04-05 09:58 EDT by Ilya Basin CLA
Modified: 2020-09-04 15:19 EDT (History)
2 users (show)

See Also:


Attachments
test-conflicting-types (1.81 KB, application/octet-stream)
2018-04-05 09:58 EDT, Ilya Basin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Basin CLA 2018-04-05 09:58:32 EDT
Created attachment 273449 [details]
test-conflicting-types

There's an ancient makefile project that builds two libraries: single-threaded and multi-threaded. In the single-threaded library there's a variable to hold the error status: "int pits_error". Naturally, the multi-threaded library can't use such a variable and it defines the function with the same name: "int pits_error()"

The object files from both libraries never end up in a single executable, therefore this situation is not a bug.

When opening the single-threaded c file in the editor, the error appears: Symbol 'pits_error' could not be resolved.

I have narrowed the problem. Please import the attached file as a makefile project, build and open single.c. There should be an error.

This only happens if the symbol is declared in a header file. If I duplicate the declaration to the source file, the problem is gone.
Comment 1 Nathan Ridge CLA 2018-04-05 16:37:38 EDT
This is a long-standing issue with Eclipse's indexer. It basically treats all source files as if they were all linked into a single executable or library.