GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — defined() not recognizing ## token paste in its operand (GNU extension) · Issue #653 · cppcheck-opensource/simplecpp

defined() not recognizing ## token paste in its operand (GNU extension) #653

New issue
Copy link
New issue
Copy link
Open
Open
defined() not recognizing ## token paste in its operand (GNU extension)#653
Copy link
Labels
bug

Description

@wjakobsson
wjakobsson
opened on May 21, 2026
Issue body actions

When defined() appears inside a macro with ## op, syntaxError gets emitted.

error: failed to evaluate #if condition, undefined function-like macro invocation: defined( ... ) [syntaxError]
#if NRF_MODULE_ENABLED(FOO)

Reproducer: main.c

#define NRF_MODULE_ENABLED(module) \
    (defined(module ## _ENABLED) && (module ## _ENABLED))

#define FOO_ENABLED 1

#if NRF_MODULE_ENABLED(FOO)
int foo(void) { return 1; }
#endif

This is caused by the DEFINED branch in expandToken, which doesn't match defined(A ## B), and makes the token 'defined(...)' fall through.

Activity

  1. firewave
    added
    bug
    on May 28, 2026
  2. firewave commented on May 28, 2026

    @firewave
    firewave
    on May 28, 2026
    Collaborator
    More actions

    Looks related to #300, #218 and #75.

    gcc -E and clang -E show:

    
    
    
    
    
    
    int foo(void) { return 1; }
    
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.