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

breathe doesn't pass c:function properly with a C array syntax in parameter declaration #854

Open
2bndy5 opened this issue Jun 21, 2022 · 1 comment

Comments

@2bndy5
Copy link
Contributor

2bndy5 commented Jun 21, 2022

This was discovered in #816 when resolving all warning produced by sphinx-build. So, the test project (see link below) is taken from the original breathe docs, namely examples/specific/array.h.

The C style array declared as an argument to a function is not recognized by Sphinx and is reported in the following warning:

full build log
(venv) PS path\to\C-array> sphinx-build docs docs/_build/html
Running Sphinx v4.5.0
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
Running directive: .. c:function::  int bar (int n, int a[static n])

path\to\C-array\docs\index.rst.rst:13: WARNING: Parsing of expression failed. Using fallback parser. Error was:
Error in postfix expression, expected primary expression or type.
If primary expression:
  Invalid C++ declaration: Expected identifier in nested name, got keyword: static [error at 28]      
    int bar (int n, int a[static n])
    ----------------------------^
If type:
  Invalid C++ declaration: Expected identifier in nested name, got keyword: static [error at 28]      
    int bar (int n, int a[static n])
    ----------------------------^

looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindex done
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 1 warning.

The HTML pages are in docs\_build\html.

example project

C-array.zip

Preliminary research suggests that breathe does in fact invoke the c:function directive (notice the C domain), but something else is happening here because the warning says Invalid C++ declaration:.

@2bndy5
Copy link
Contributor Author

2bndy5 commented Jun 30, 2022

I was curious, so I hard-coded an rst file with

.. c:function:: int bar(int n, int a[static [n]);

and it worked fine with sphinx. So, now I'm thinking there's something weird with how the directive is invoked in breathe.

@2bndy5 2bndy5 changed the title Sphinx doesn't recognizes C array syntax breathe doesn't pass c:function properly with a C array syntax in parameter declaration Jun 30, 2022
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