Skip to content

No redefinition of yyguts_t by the setting %option prefix="codeYY" #877

Closed

Description

@albert-github

When compiling multiple lex files (with flex 2.6.4, though as far as I can tell this would also occur 2.6.17) we get warnings:

/home/runner/work/doxygen/doxygen/build/generated_src/code_intermediate.cpp:28376: warning: type ‘struct yyguts_t’ violates the C++ One Definition Rule [-Wodr]
28376 | struct yyguts_t
      | 
/home/runner/work/doxygen/doxygen/build/generated_src/commentcnv_intermediate.cpp:3881: note: a different type is defined in another translation unit
 3881 | struct yyguts_t
      | 
/home/runner/work/doxygen/doxygen/build/generated_src/code_intermediate.cpp:28380: note: the first difference of corresponding definitions is field ‘yyextra_r’
28380 |     YY_EXTRA_TYPE yyextra_r;
      | 
/home/runner/work/doxygen/doxygen/build/generated_src/commentcnv_intermediate.cpp:3885: note: a field of same name but different type is defined in another translation unit
 3885 |     YY_EXTRA_TYPE yyextra_r;
      | 
/home/runner/work/doxygen/doxygen/src/code.l:93: note: type name ‘codeYY_state’ should match type name ‘commentcnvYY_state’
   93 | struct codeYY_state
      | 
/home/runner/work/doxygen/doxygen/src/commentcnv.l:106: note: the incompatible type is defined here
  106 | struct commentcnvYY_state
      | 

Looking in these .l files we see:

%option never-interactive
%option prefix="codeYY"
%option reentrant
%option extra-type="struct codeYY_state *"

and

%option never-interactive
%option prefix="commentcnvYY"
%option reentrant
%option extra-type="struct commentcnvYY_state *"

Looking in the cpp files we see that a lot of definitions adhere to the prefix though yyguts_t does not.
(Yes the state structs should be different)

How to solve this problem?

Referenced files: files.tar.gz

Activity

  1. added a commit that references this issue on Nov 23, 2026
    15e0e63
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