Bug 579725 - java.lang.UnsupportedOperationException when running indexer
Summary: java.lang.UnsupportedOperationException when running indexer
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 10.5.0   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: cxx17
  Show dependency tree
 
Reported: 2022-04-18 15:15 EDT by Patrick Wright CLA
Modified: 2022-04-19 14:58 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Wright CLA 2022-04-18 15:15:30 EDT
I have a project in the STM32CubeIDE which is built upon Eclipse and the Eclipse CDT.  I have been fighting problems in the indexer where certain files are not being indexed correctly.  The code compiles without issue, it is only the CDT indexer which has problems.  I can (possibly) trace the "problem" down to something to do with using constexpr.

Upon running eclipse in debug mode, I found (as an example) this exception being generated.

Indexer: parsing \2-Wire AV Base\avbase\src\tw\avbase\strobe\StrobeSubsystem.cpp
[1,650,308,159,184] Parsed StrobeSubsystem.cpp: 13 ms. Ambiguity resolution: 3 ms
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(33); A template id provides illegal arguments for the instantiation: gpio_output_t
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(33); Attempt to use symbol failed: LEDS_RED_PORTPIN_T
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(35); A template id provides illegal arguments for the instantiation: gpio_output_t
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(35); Attempt to use symbol failed: LEDS_GREEN_PORTPIN_T
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(41); A template id provides illegal arguments for the instantiation: gpio_output_t
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(41); Attempt to use symbol failed: WATCHDOG_KICK_PORTPIN_T
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(47); A template id provides illegal arguments for the instantiation: UARTDriverConfigType
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(48); Attempt to use symbol failed: CONFIG_NETWORK_ST8500_UART_T
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(49); Attempt to use symbol failed: CONFIG_NETWORK_ST8500_UART_RX_DMA_CHANNEL_T
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(50); Attempt to use symbol failed: CONFIG_NETWORK_ST8500_UART_TX_DMA_CHANNEL_T
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(51); Attempt to use symbol failed: CONFIG_NETWORK_ST8500_UART_RX_PORTPIN_T
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(52); Attempt to use symbol failed: CONFIG_NETWORK_ST8500_UART_TX_PORTPIN_T
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\_bsp.h(56); A template id provides illegal arguments for the instantiation: UARTDriver
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\strobe\StrobeSubsystem.h(39); A template id provides illegal arguments for the instantiation: Pack
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\strobe\StrobeSubsystem.h(40); A template id provides illegal arguments for the instantiation: reference_wrapper
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\strobe\StrobeSubsystem.h(46); A template id provides illegal arguments for the instantiation: reference_wrapper
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\strobe\StrobeSubsystem.h(60); A template id provides illegal arguments for the instantiation: GPIOOutputDriver
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\include\tw\avbase\strobe\StrobeSubsystem.h(60); Attempt to use symbol failed: CONFIG_STROBE_ENABLE_PORTPIN_T
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\src\tw\avbase\strobe\StrobeSubsystem.cpp(25); A template id provides illegal arguments for the instantiation: reference_wrapper
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\src\tw\avbase\strobe\StrobeSubsystem.cpp(29); Attempt to use symbol failed: CONFIG_STROBE_ENABLE_GPIOCONFIGURATION
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\src\tw\avbase\strobe\StrobeSubsystem.cpp(30); Attempt to use symbol failed: Strobe
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\src\tw\avbase\strobe\StrobeSubsystem.cpp(58); Attempt to use symbol failed: control
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\src\tw\avbase\strobe\StrobeSubsystem.cpp(68); Attempt to use symbol failed: control
Indexer: unresolved name at C:\Users\h321355\Documents\2WireAV\avbasestm32copy\avbase\src\tw\avbase\strobe\StrobeSubsystem.cpp(75); Attempt to use symbol failed: control
Indexer: exception: java.lang.UnsupportedOperationException
        at org.eclipse.cdt.internal.core.dom.parser.IntegralValue$1.setSubValue(IntegralValue.java:47)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalCompositeAccess.update(EvalCompositeAccess.java:53)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalReference.update(EvalReference.java:122)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinary.computeForFunctionCall(EvalBinary.java:499)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExecExpressionStatement.executeForFunctionCall(ExecExpressionStatement.java:39)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUtil.executeStatement(EvalUtil.java:87)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExecCompoundStatement.executeForFunctionCall(ExecCompoundStatement.java:63)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall.evaluateFunctionBody(EvalFunctionCall.java:350)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall.computeForFunctionCall(EvalFunctionCall.java:316)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExecExpressionStatement.executeForFunctionCall(ExecExpressionStatement.java:39)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUtil.executeStatement(EvalUtil.java:87)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExecCompoundStatement.executeForFunctionCall(ExecCompoundStatement.java:63)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall.evaluateFunctionBody(EvalFunctionCall.java:350)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall.getValue(EvalFunctionCall.java:187)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable.computeInitialValue(CPPVariable.java:271)
        at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable.getInitialValue(CPPVariable.java:248)
        at org.eclipse.cdt.internal.core.pdom.PDOMWriter.resolveNames(PDOMWriter.java:441)
        at org.eclipse.cdt.internal.core.pdom.PDOMWriter.addSymbols(PDOMWriter.java:284)
        at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.writeToIndex(AbstractIndexerTask.java:1295)
        at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseFile(AbstractIndexerTask.java:1107)
        at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseLinkage(AbstractIndexerTask.java:944)
        at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.runTask(AbstractIndexerTask.java:572)
        at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.run(PDOMIndexerTask.java:164)
        at org.eclipse.cdt.internal.core.pdom.indexer.PDOMUpdateTask.run(PDOMUpdateTask.java:96)
        at org.eclipse.cdt.internal.core.pdom.PDOMIndexerJob.run(PDOMIndexerJob.java:160)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Where, the file in question will have an error in the indexer log output like:

"Unresolved includes (from headers in index):"

However, by simply commenting out a line of code that has a constexpr (no changes to the include structure or paths), this message goes away and no exception is generated.

Unfortunately, I cannot seem to create a minimum reproducible error.  I am only speculating as to the cause.
Comment 1 Jonah Graham CLA 2022-04-19 14:28:50 EDT
Hi @Patrick,

Thanks for the bug report. Your conclusion looks sound, this looks like an issue in the constexpr function support, initially added in Bug 490475.

Are you using C++14, 17 or other? The C++17 support is incomplete in CDT.
Comment 2 Patrick Wright CLA 2022-04-19 14:48:13 EDT
@Jonah Graham,

I am using C++17.
Comment 3 Jonah Graham CLA 2022-04-19 14:58:13 EDT
(In reply to Patrick Wright from comment #2)
> @Jonah Graham,
> 
> I am using C++17.

Thanks for coming back to me on this. The reality is that there is no significant active development on support C++17 in CDT at the moment - see https://www.eclipse.org/lists/cdt-dev/msg35072.html - for a message from the last active CDT developer who was dedicated to this area.