Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined literal operators are not accepted when using Espressif’s xtensa-esp32-elf-gcc version 13.2.0 #12719

Open
gralpli opened this issue Sep 14, 2024 · 1 comment
Labels
bug Feature: Configuration An issue related to configuring the extension or IntelliSense Language Service

Comments

@gralpli
Copy link

gralpli commented Sep 14, 2024

Environment

  • OS and Version: Debian 12.7
  • VS Code Version: 1.93.1
  • C/C++ Extension Version: v1.22.3 (pre-release)
  • CMake Tools Extension Version: v1.20.6 (pre-release)
  • GCC version: xtensa-esp-elf-g++ (crosstool-NG esp-13.2.0_20240530) 13.2.0 (the one that gets installed by Espressif’s ESP-IDF v5.3.1)

Bug Summary and Steps to Reproduce

Bug Summary:

User-defined literal operators are not accepted by the C/C++ Extension:

github-issue

This issue is similar to #7034, but the solution implemented back then apparently is not working anymore. @Colengms wrote:

“However, this compiler returns xtensa-esp32-elf-gcc for -dumpmachine, which we are not handling. We could possibly handle this by considering any occurrences of 32 and 64 within the target string instead of giving up.”

My xtensa-esp32-elf-gcc in version 13.2.0 is now returning just xtensa-esp-elf for -dumpmachine which may explain why the same bug appears again.

Steps to reproduce:

cd
mkdir esp
cd esp
git clone -b v5.3.1 --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
./install.sh esp32
. export.sh
cd
mkdir temp
cd temp
printf "cmake_minimum_required(VERSION 3.16)\ninclude(\$ENV{IDF_PATH}/tools/cmake/project.cmake)\nproject(myproject)" > CMakeLists.txt
mkdir main
cd main
printf "idf_component_register(SRCS \"main.cpp\")" > CMakeLists.txt
printf "#include <cstddef>\n\nconstexpr int operator\"\"_lit(char const* s, size_t) {\n    return 0;\n}" > main.cpp
cd ..
code .

Now let the CMake Extension configure the project (select “[Unspecified]” for the kit) and open the file main/main.cpp. You should see the error.

Note: . export.sh sets environment variables. VSCode must be started from the terminal while these environment variables are active.

Configuration and Logs

I’m using CMake Tools as the C/C++ configuration provider.

C/C++ Extension Log:

loggingLevel: Information
Custom configuration provider 'CMake Tools' registered
cpptools version (TypeScript): 1.22.3
cpptools version (native): 1.22.3.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
Querying compiler for default C++ language standard using command line: /usr/bin/gcc -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/gcc" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Code browsing service initialized
  Folder: /usr/include/ will be indexed
  Folder: /usr/lib/gcc/x86_64-linux-gnu/12/include/ will be indexed
  Folder: /usr/local/include/ will be indexed
  Folder: /home/gralpli/myproject/ will be indexed
Discovering files...
  Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/12/include/
  Processing folder (recursive): /usr/include/
  Processing folder (recursive): /usr/local/include/
  Processing folder (recursive): /home/gralpli/myproject/
Querying compiler for default C++ language standard using command line: /home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc" -dumpmachine
Compiler returned default target value: xtensa-esp-elf
Unhandled default compiler target value detected: xtensa-esp-elf
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Failed to query compiler. Falling back to no bitness.
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Failed to query compiler. Falling back to no bitness.
  Unable to retrieve file system information for /home/gralpli/myproject/build/extension/partition_table. error = -1
  Folder: /home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/include/ will be indexed
  Folder: /home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/include-fixed/ will be indexed
  Folder: /home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/ will be indexed
  Folder: /home/gralpli/myproject/build/ will be indexed
  Folder: /home/gralpli/esp/esp-idf/components/ will be indexed
  Folder: /home/gralpli/myproject/main/ will be indexed
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
  Discovering files: 124 file(s) processed
Done discovering files.
Discovering files...
Failed to query compiler. Falling back to no bitness.
  Processing folder (recursive): /home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/include-fixed/
  Processing folder (recursive): /home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/
  Processing folder (recursive): /home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/lib/gcc/xtensa-esp-elf/13.2.0/include/
  Processing folder (recursive): /home/gralpli/myproject/build/
  Processing folder (recursive): /home/gralpli/esp/esp-idf/components/
  Processing folder (recursive): /home/gralpli/myproject/main/
  Discovering files: 18951 file(s) processed
  109 file(s) removed from database
Done discovering files.
Populating include completion cache.
Parsing remaining files...
  Parsing: 0 files(s) processed
Done parsing remaining files.
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
Enhanced Colorization is enabled.

CMake: Log Diagnostics:

{
  "os": "linux",
  "vscodeVersion": "1.93.1",
  "cmtVersion": "1.20.6",
  "configurations": [
    {
      "folder": "/home/gralpli/myproject",
      "cmakeVersion": "3.30.3",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc",
        "CXX": "/home/gralpli/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-g++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 130,
    "executablesCount": 1,
    "librariesCount": 88,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": false
    }
  ]
}
@sean-mcmanus sean-mcmanus added bug Language Service Feature: Configuration An issue related to configuring the extension or IntelliSense labels Sep 16, 2024
@sean-mcmanus
Copy link
Collaborator

@Colengms Should we check the compilerPath string for "esp32" if "esp" is in the target?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Feature: Configuration An issue related to configuring the extension or IntelliSense Language Service
Projects
Status: No status
Development

No branches or pull requests

2 participants