Skip to content

Support for GCC14 #12436

Closed
Closed

Description

@raiden00pl

Many NuttX configurations doesn't compile correctly with gcc14 and some return new warnings.
Since correcting everything will take some time, I'm opening a new issue to track progress.

Here are the porting instructions: https://gcc.gnu.org/gcc-14/porting_to.html

TODOs

  • new warnings for nimble - example: nrf52832-dk/sdc_nimble
    fixed here porting/npl/nuttx/include/nimble/nimble_npl_os_log.h: fix gcc14 error mynewt-nimble#1795
  • libcxx compilation is broken - example: stm32f4discovery/testlibcxx
  • include/crypto/curve25519.h:42:5: error: implicit declaration of function 'arc4random_buf'
  • include/nuttx/net/netfilter/ip_tables.h:281:24: error: returning 'char *' from a function with incompatible return type 'struct xt_entry_target *'
  • drivers/clk/clk.h:xx:5: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  • drivers/video/v4l2_cap.c:798:3: error: pointer/integer type mismatch in conditional expression [-Wint-conversion]
  • include/nuttx/spi/spi_bitbang.c

Activity

  1. augustofg commented on Jul 16, 2024

    @augustofg
    Contributor

    The SPI generic bitbang implementation also fails with GCC 14 due to a function pointer incompatibility:

    /home/augusto/repos/lnls/rffe-uc-fw/nuttx/include/nuttx/spi/spi_bitbang.c:257:22: error: assignment to 'bitexchange_t' {aka 'unsigned char (*)(unsigned char,  unsigned int)'} from incompatible pointer type 'uint16_t (*)(uint16_t,  uint32_t)' {aka 'short unsigned int (*)(short unsigned int,  unsigned int)'} [-Wincompatible-pointer-types]
      257 |       priv->exchange = spi_bitexchange0;
          |                      ^
    /home/augusto/repos/lnls/rffe-uc-fw/nuttx/include/nuttx/spi/spi_bitbang.c:266:22: error: assignment to 'bitexchange_t' {aka 'unsigned char (*)(unsigned char,  unsigned int)'} from incompatible pointer type 'uint16_t (*)(uint16_t,  uint32_t)' {aka 'short unsigned int (*)(short unsigned int,  unsigned int)'} [-Wincompatible-pointer-types]
      266 |       priv->exchange = spi_bitexchange1;
          |                      ^
    /home/augusto/repos/lnls/rffe-uc-fw/nuttx/include/nuttx/spi/spi_bitbang.c:275:22: error: assignment to 'bitexchange_t' {aka 'unsigned char (*)(unsigned char,  unsigned int)'} from incompatible pointer type 'uint16_t (*)(uint16_t,  uint32_t)' {aka 'short unsigned int (*)(short unsigned int,  unsigned int)'} [-Wincompatible-pointer-types]
      275 |       priv->exchange = spi_bitexchange2;
          |                      ^
    /home/augusto/repos/lnls/rffe-uc-fw/nuttx/include/nuttx/spi/spi_bitbang.c:284:22: error: assignment to 'bitexchange_t' {aka 'unsigned char (*)(unsigned char,  unsigned int)'} from incompatible pointer type 'uint16_t (*)(uint16_t,  uint32_t)' {aka 'short unsigned int (*)(short unsigned int,  unsigned int)'} [-Wincompatible-pointer-types]
      284 |       priv->exchange = spi_bitexchange3;
    

    The bitexchange_t type is defined here (returns an uint8_t and the dataout argument is also uint8_t):

    /* This is the type of the function that can exchange one bit */
    typedef CODE uint8_t (*bitexchange_t)(uint8_t dataout, uint32_t holdtime);

    But the spi_bitexchange functions have a different signature:

    #ifndef SPI_BITBANG_DISABLEMODE0
    static uint16_t spi_bitexchange0(uint16_t dataout, uint32_t holdtime);
    #endif
    #ifndef SPI_BITBANG_DISABLEMODE1
    static uint16_t spi_bitexchange1(uint16_t dataout, uint32_t holdtime);
    #endif
    #ifndef SPI_BITBANG_DISABLEMODE2
    static uint16_t spi_bitexchange2(uint16_t dataout, uint32_t holdtime);
    #endif
    #ifndef SPI_BITBANG_DISABLEMODE3
    static uint16_t spi_bitexchange3(uint16_t dataout, uint32_t holdtime);
    #endif

  2. raiden00pl commented on Aug 23, 2025

    @raiden00pl
    MemberAuthor

    unresolved tasks moved to a new issue about GCC15: #16896

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions