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

wrong output with optional names for bitfields in C structs (Origin: bugzilla #609517) #3671

Open
doxygen opened this issue Jul 2, 2018 · 1 comment

Comments

@doxygen
Copy link
Owner

doxygen commented Jul 2, 2018

status NEW severity normal in component general for ---
Reported in version 1.6.1 on platform Other
Assigned to: Dimitri van Heesch

Original attachment names and IDs:

On 2010-02-10 09:52:50 +0000, Alexander Dahl wrote:

Created attachment 153396
C header file with type definition to reproduce this bug

You can use structs in the C language to easily access single bits by
defining bit fields. This is especially useful in combination with unions
when programming microcontrollers.

When defining such a bit field the name for a single bit is optional. So
there's no need to use dummy variables for bits you don't access anyway. See
this short example taken form the book »C kurz & gut«:

    struct {
        unsigned int b0_2  : 3;
        signed   int b3_7  : 5;
        unsigned int       : 7;
        unsigned int b15   : 1;
    } bar;

The output of doxygen when it hits such code is wrong. If you have just one
not named bit, it emphasises the type bold, which would be int in the above
case. If there are more not named bits, some others are even dropped in the
created documentation. I assume a bug in the C code parser used by doxygen.

I created example code to reproduce this bug with doxygen 1.6.1 on Debian
Squeeze and with doxygen 1.6.2 on Windows XP and attached the file. I used
the generated Doxyfile and just changed the following lines:

OUTPUT_DIRECTORY       = ./doc
OPTIMIZE_OUTPUT_FOR_C  = YES
INPUT                  = .
@albert-github
Copy link
Collaborator

I've just pushed a proposed patch, pull request #9581

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

No branches or pull requests

2 participants