Clang intellisense is not recognising bool correctly

Sysprogs forums Forums VisualGDB Clang intellisense is not recognising bool correctly

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #37126
    wtywtykk
    Participant

    Hi,

    I’m having issue with the intellisense. It’s showing underlines on bool/true/false, saying “Use of undeclared identifier bool”. But the file can actually compile.

    I think the problem may be some version discrepancy. In stdbool.h, it’s not declaring the type because it thinks it should be keywords, while clang doesn’t think so:

    #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
    /* bool, true and false are keywords. */
    #else
    #define bool _Bool
    #define true 1
    #define false 0
    #endif

    Example code to reproduce: Note the extension of the file is .c, not cpp.

    The GCC tool chain version is 15.2.1/15.2/r1

     

    #include

    int main(void)
    {
    bool aaa = false;

    return 0;
    }

     

    cmake_minimum_required(VERSION 3.15)

    project(EmbeddedProject1_bool LANGUAGES C CXX ASM)

    find_bsp(
    ID com.sysprogs.arm.stm32f4
    VERSION 1.28.0
    MCU STM32F407VE
    FRAMEWORKS com.sysprogs.arm.stm32.hal com.sysprogs.arm.stm32.ll
    HWREGISTER_LIST_FILE STM32F4xxxx/DeviceDefinitions/stm32f407xx.xml
    DISABLE_GNU_EXTENSIONS)

    add_bsp_based_executable(
    NAME EmbeddedProject1_bool
    SOURCES EmbeddedProject1_bool.c system_stm32f4xx.c stm32f4xx_hal_conf.h
    GENERATE_BIN
    GENERATE_MAP
    OUTPUT_RELOCATION_RECORDS)

     

    Is there any way to fix that?

     

    Regards,

    Tianyi

    • This topic was modified 2 hours, 8 minutes ago by wtywtykk.
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.