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

Valueless enum members are generated incorrectly #240

Closed
natezb opened this issue Mar 8, 2018 · 6 comments
Closed

Valueless enum members are generated incorrectly #240

natezb opened this issue Mar 8, 2018 · 6 comments

Comments

@natezb
Copy link
Contributor

natezb commented Mar 8, 2018

This seems to have been introduced by #216, which inadvertently removed some special-case checks. Enum members that don't have an assigned value now generate an invalid, empty assignment. For example:

typedef enum MOT_TravelModes
{
  MOT_TravelModeUndefined = ,
  MOT_Linear = 0x01,
  MOT_Rotational = 0x02
} MOT_TravelModes;

In the original code, MOT_TravelModeUndefined was assigned no value, and should be generated with no = sign.

@SethPoulsen
Copy link
Contributor

SethPoulsen commented Mar 15, 2018

I just came here to report them same problem. I'm going to have a go at fixing it.

@eliben
Copy link
Owner

eliben commented Mar 15, 2018

@altendky PTAL

SethPoulsen pushed a commit to SethPoulsen/pycparser that referenced this issue Mar 15, 2018
SethPoulsen pushed a commit to SethPoulsen/pycparser that referenced this issue Mar 15, 2018
@SethPoulsen
Copy link
Contributor

No need. I got it sorted out.

eliben pushed a commit that referenced this issue Mar 16, 2018
* Fixed enum formatting in generating C code (issue #240).

* Added another enum test. Removed twice-defined function.
@saullocarvalho
Copy link
Contributor

Is this still an issue? It seems like a commit has already fixed it.

@SethPoulsen
Copy link
Contributor

Ya, I fixed it. It should be closed.

@natezb
Copy link
Contributor Author

natezb commented Jun 7, 2019

Just tested under 2.19, and works for me.

@natezb natezb closed this as completed Jun 7, 2019
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

4 participants