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

Write rules against the location of the type/define rather than the name #168

Open
nickh-stripe opened this issue May 25, 2024 · 0 comments

Comments

@nickh-stripe
Copy link

I'm trying to generate some Go code from C enums, and the generated output has the enums and their values 🎉 but it also includes a bunch of stdlib types/defines as well, my const.go has:

...
	// INT64_MAX as defined in include/stdint.h:499
	INT64_MAX = 0x10041bb70
	// INT64_MIN as defined in include/stdint.h:500
	INT64_MIN = 0x10041bb70
	// UINT64_MAX as defined in include/stdint.h:501
	UINT64_MAX = 0x10041bb70
...

I assume this is because my config is:

TRANSLATOR:
  ConstRules:
    defines: expand
    enum: expand
  Rules:
    type:
      - {action: accept, from: "^thing.*$"}
    const:
      - {action: accept, from: "^[A-Z].*$"}

and i'm accepting any upper case const, but i only want to accept my const/types not the stdlib ones that are also included by my header file, this seems like something everyone would encounter so I must be missing something? Can i write a rule that drops anything from include/stdint.h ?

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

No branches or pull requests

1 participant