Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse CDT 2021-06 has problems with indexing(std::function and range based for are not indexed)
Eclipse CDT 2021-06 has problems with indexing [message #1842470] Mon, 21 June 2021 07:25 Go to next message
Victor Uchaev is currently offline Victor UchaevFriend
Messages: 6
Registered: June 2021
Junior Member
I have installed the new version of eclipse - Eclipse CDT 2021-06 - and GNU MCU ARM Embedded Toolchain v10.2.1 for STM32 MCU development.

All works fine: editor, compiler, perspectives, debugger and so on. Except the indexer: functional objects and iterators of containers with users classes are not indexed, the code analizer underlines with red them.

There are selected following providers in project properties (Item C/C++ General -- Preprocessor Include Paths, Macros etc -- Prividers):
- CDT User Entries;
- Exported Entries from References Projects;
- CDT Managed Build Settings Entries;
- CDT Arm Cross GCC Built-in Compiler Settings (for this there are set following options: ${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}").

The project is made with ++2a language.

Code example:
#include <cstdint>
#include <vector>
#include <functional>
  // user class
  class Coor {
      public:
      Coor() = default;
      ~Coor() = default;
      void SetX(const uint16_t in_value) { x = in_value; }
      void SetY(const uint16_t in_value) { y = in_value; }
      uint16_t GetX() { return x; }
      uint16_t GetY() { return y; }
      private:
      uint16_t x{0}, y{0};
  };
int
main(int argc, char* argv[])
{
    static constexpr size_t kSize{10};
    std::vector<Coor> coor(kSize);
    uint8_t  i{0};
    for (auto& c : coor) {
        c.SetX(i * i);
        c.SetY(2 * i);
        ++i;
    }
    std::function<void()> ClearLastElement = [&coor]() mutable {
        auto& last = *coor.rbegin();
        last.SetX(0);
        last.SetY(0);
    };
    ClearLastElement();
}

Code is compiled and works fine but editor underlines methods SetX() and SetY() and name ClearLastElement in initialization.

There are the indexer errors on the downloaded images.

index.php/fa/40660/0/

index.php/fa/40659/0/

The question is that how can I setup the indexer correctly? I tried various combination of providers settings. Nothing works.
Re: Eclipse CDT 2021-06 has problems with indexing [message #1842487 is a reply to message #1842470] Mon, 21 June 2021 14:46 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
What is the value of __cplusplus in the compiler built-ins?
The default std used by GCC depends on the compiler version.
The compiler built-in output will use the default std unless you override it.

Re: Eclipse CDT 2021-06 has problems with indexing [message #1842509 is a reply to message #1842487] Tue, 22 June 2021 02:51 Go to previous messageGo to next message
Victor Uchaev is currently offline Victor UchaevFriend
Messages: 6
Registered: June 2021
Junior Member
Hi, David.

There are three built-in compiler selected in project properties: CDT Arm Cross GCC Built-in, CDT Cross GCC Built-in and CDT GCC Built-in.

Parameters set in theirs settings are same:

  • __cplusplus=201709L;
  • __cpp_generic_lambdas=201707L;
  • __cpp_lambdas=200907L;
  • __cpprange_based_for=201603L.


I think so that these settings are proper for indexing of lambdas and range based for, aren't they?
How can I override the setting? And where can I see what value is correct for c++2a code indexing?

Thanks
Re: Eclipse CDT 2021-06 has problems with indexing [message #1842519 is a reply to message #1842509] Tue, 22 June 2021 06:12 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
I have no idea.
Unsurprisingly they are the same as I get when setting std=c++20 with ARM v10.2.1.

You could go to the GNU site for more info.
The following is for normal GCC
Not sure if the ARM compiler is the same.
https://gcc.gnu.org/projects/cxx-status.html
ARM links
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm
https://launchpad.net/gcc-arm-embedded/+announcement/28093


You aren't using features features needed by c++20
In fact, it all works fine in Eclipse 2021-03 with std=c++14
It's unlikely the Indexer is broken in 2021-06 but it could be.

Forum is acting strangely when attaching files.
Here's what I get in the editor (maybe):
index.php/fa/40676/0/

Perhaps you just need to rebuild the index?
Initially the Indexer had problems but rebuilding it fixed things.


[Updated on: Tue, 22 June 2021 06:28]

Report message to a moderator

Re: Eclipse CDT 2021-06 has problems with indexing [message #1842531 is a reply to message #1842519] Tue, 22 June 2021 12:12 Go to previous messageGo to next message
Victor Uchaev is currently offline Victor UchaevFriend
Messages: 6
Registered: June 2021
Junior Member
That was simply example. Really I use c++2a.

Sure, I know how to rebuild the indexer :-) It doesn't help.

The problem is somewhere in bundle of "eclipse + gnu arm gcc 10.2.1" because the x86 gcc compiler works fine with Eclipse 2021-06 and indexer that has same entry settings (as I pointed earlier for GNU GSS Arm) gives no errors .

How can I make an issue to Eclipse bugtracker?
Re: Eclipse CDT 2021-06 has problems with indexing [message #1842532 is a reply to message #1842531] Tue, 22 June 2021 12:27 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Link to eclipse bugs
https://bugs.eclipse.org/bugs/

You will need an account.
There is an option to register
Re: Eclipse CDT 2021-06 has problems with indexing [message #1842535 is a reply to message #1842532] Tue, 22 June 2021 12:57 Go to previous messageGo to next message
Victor Uchaev is currently offline Victor UchaevFriend
Messages: 6
Registered: June 2021
Junior Member
Ok, I will try to make it :-)

Thanks for help
Re: Eclipse CDT 2021-06 has problems with indexing [message #1842546 is a reply to message #1842535] Wed, 23 June 2021 03:48 Go to previous messageGo to next message
Victor Uchaev is currently offline Victor UchaevFriend
Messages: 6
Registered: June 2021
Junior Member
There was opened the issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=574389 on Eclipse Bug List.
Re: Eclipse CDT 2021-06 has problems with indexing [message #1842673 is a reply to message #1842546] Mon, 28 June 2021 12:31 Go to previous message
Victor Uchaev is currently offline Victor UchaevFriend
Messages: 6
Registered: June 2021
Junior Member
There is no way to fix this issue. C++20 will not be supported by Eclipse indexer.
Previous Topic:C++ on Arduino project
Next Topic:Dark Theme issues in Windows
Goto Forum:
  


Current Time: Thu Mar 28 12:07:12 GMT 2024

Powered by FUDForum. Page generated in 0.03188 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top