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

"Invalid C declaration" on C function with macro after function arguments #8114

Closed
protobits opened this issue Aug 13, 2020 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@protobits
Copy link

Describe the bug
I have a C function definition with a trailing macro which specifies the function as "noreturn" and this gives an error during build, even when this keyword is defined in c_id_attributes.

To Reproduce
I have the following on an RST:

.. c:function:: void up_exit(int status) noreturn_function;

And this on the config:

c_id_attributes = [
  'FAR',
  'CODE',
  'noreturn_function'
]

And during build I get:

/home/v01d/coding/nuttx_docs/nuttx/doc/reference/os/arch.rst:225: WARNING: Invalid C declaration: Expected end of definition. [error at 25]
  void up_exit(int status) noreturn_function;
  -------------------------^

Expected behavior
The macro should be ignored while parsing the function declaration.

Your project
https://github.com/v01d/incubator-nuttx/tree/docs/doc

Environment info

  • OS: Ubuntu 20.04
  • Python version: 3.8.2
  • Sphinx version: 3.1.2
  • Sphinx extensions: sphinx.ext.autodoc, recommonmark
jakobandersen added a commit to jakobandersen/sphinx that referenced this issue Aug 13, 2020
@jakobandersen jakobandersen added domains:cpp type:enhancement enhance or introduce a new feature labels Aug 13, 2020
@jakobandersen jakobandersen added this to the 3.2.1 milestone Aug 13, 2020
@jakobandersen jakobandersen self-assigned this Aug 13, 2020
@jakobandersen
Copy link
Contributor

Thanks! Attributes can appear in many different places, and parsing of them was simply not added to this position. It should be in the next version (#8078), so your code should work then.
Note though that custom attributes are not ignored by the parser, but are rendered in the output.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants