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

c++2rst in triqs/tprf application (parse errors in triqs?) #5

Open
HugoStrand opened this issue Nov 14, 2017 · 4 comments
Open

c++2rst in triqs/tprf application (parse errors in triqs?) #5

HugoStrand opened this issue Nov 14, 2017 · 4 comments

Comments

@HugoStrand
Copy link
Member

Hi, I am trying to use c++2rst to generate the doc for tprf
https://github.com/HugoStrand/tprf

But the c++2rst function CL.parse encounters problems inside of triqs

[ 67%] Generating c++2rst.log
cd /Users/hugstr/dev/tprf/cbuild/doc && /Users/hugstr/apps/cpp2py/bin/c++2rst --namespace tprf /Users/hugstr/dev/tprf/doc/reference/doc_root.hpp --output_directory=/Users/hugstr/dev/tprf/cbuild/doc/cpp2doc_generated --includes=/Users/hugstr/dev/tprf/ -I /opt/local/include/openmpi-clang40 -I /opt/local/include -I /opt/local/include -I /opt/local/include -I /opt/local/include 2>&1 > c++2rst.log
Traceback (most recent call last):
  File "/Users/hugstr/apps/cpp2py/bin/c++2rst", line 36, in <module>
    libclang_location = args.libclang_location
  File "/Users/hugstr/apps/cpp2py/lib/python2.7/site-packages/cpp2rst/cpp2rst.py", line 60, in __init__
    self.root = CL.parse(filename, compiler_options, includes, libclang_location, parse_all_comments)
  File "/Users/hugstr/apps/cpp2py/lib/python2.7/site-packages/cpp2py/clang_parser.py", line 356, in parse
    raise RuntimeError, s + "\n... Your code must compile before using clang-parser !"
RuntimeError: Clang reports the following errors in parsing
 file /Users/hugstr/apps/triqs_devel/include/triqs/./gfs/../utility/complex_ops.hpp line 5 col 38
expected a type file /Users/hugstr/apps/triqs_devel/include/triqs/./gfs/../utility/complex_ops.hpp line 6 col 38
expected a type file /Users/hugstr/apps/triqs_devel/include/triqs/utility/c14.hpp line 75 col 5
'auto' not allowed in function return type file /Users/hugstr/apps/triqs_devel/include/triqs/utility/c14.hpp line 75 col 41
expected ';' at end of declaration list file /Users/hugstr/apps/triqs_devel/include/triqs/utility/c14.hpp line 82 col 5
'auto' not allowed in function return type file /Users/hugstr/apps/triqs_devel/include/triqs/utility/c14.hpp line 82 col 41
expected ';' at end of declaration list file /Users/hugstr/apps/triqs_devel/include/triqs/utility/c14.hpp line 88 col 5
'auto' not allowed in function return type file /Users/hugstr/apps/triqs_devel/include/triqs/utility/c14.hpp line 88 col 41
expected ';' at end of declaration list file /Users/hugstr/apps/triqs_devel/include/triqs/utility/c14.hpp line 123 col 14
unknown type name 'constexpr' file /Users/hugstr/apps/triqs_devel/include/triqs/utility/c14.hpp line 123 col 30
expected ';' at end of declaration list file /Users/hugstr/apps/triqs_devel/include/triqs/utility/c14.hpp line 131 col 66
a space is required between consecutive right angle brackets (use '> >') file /Users/hugstr/apps/triqs_devel/include/triqs/utility/is_complex.hpp line 27 col 55
a space is required between consecutive right angle brackets (use '> >') file /Users/hugstr/apps/triqs_devel/include/triqs/utility/../mpi/./base.hpp line 32 col 31
expected function body after function declarator file /Users/hugstr/apps/triqs_devel/include/triqs/utility/../mpi/./base.hpp line 118 col 67
expected expression file /Users/hugstr/apps/triqs_devel/include/triqs/utility/../mpi/./base.hpp line 118 col 24
'auto' not allowed in function return type file /Users/hugstr/apps/triqs_devel/include/triqs/utility/../mpi/./base.hpp line 118 col 105
expected ';' at end of declaration file /Users/hugstr/apps/triqs_devel/include/triqs/utility/../mpi/./base.hpp line 118 col 106
cannot use arrow operator on a type file /Users/hugstr/apps/triqs_devel/include/triqs/utility/../mpi/./base.hpp line 119 col 67
expected expression file /Users/hugstr/apps/triqs_devel/include/triqs/utility/../mpi/./base.hpp line 119 col 24
'auto' not allowed in function return type file None line 0 col 0
too many errors emitted, stopping now
... Your code must compile before using clang-parser !
make[2]: *** [doc/c++2rst.log] Error 1
make[2]: *** Deleting file `doc/c++2rst.log'
make[1]: *** [doc/CMakeFiles/doc_cpp2doc.dir/all] Error 2
make: *** [all] Error 2

am I doing something wrong when calling c++2rst in the above?

/Users/hugstr/apps/cpp2py/bin/c++2rst 
--namespace tprf /Users/hugstr/dev/tprf/doc/reference/doc_root.hpp 
--output_directory=/Users/hugstr/dev/tprf/cbuild/doc/cpp2doc_generated 
--includes=/Users/hugstr/dev/tprf/ 
-I /opt/local/include/openmpi-clang40 -I /opt/local/include 
-I /opt/local/include -I /opt/local/include -I /opt/local/include 
2>&1 > c++2rst.log
@parcollet
Copy link
Member

you need to pass -std=c++14 or 17 in the --cxxflags argument.
Cf cthyb/python/..desc file
c++2py does not assume a given standard, it probably should but @Wentzell voted against it ...
@Wentzell: opinion ?

@HugoStrand
Copy link
Member Author

Ok! I can get it working with -std=c++14 but it breaks in the same way if I pass -std=c++17.

@krivenko
Copy link
Contributor

c++2py does not assume a given standard, it probably should but @Wentzell voted against it ...

I guess forcing the standard used by the library (C++14) would render cpp2py unusable for C++17 applications. A middle ground solution I can see is to assume -std=c++14 and optionally override it with whatever passed in --cxxflags.

@parcollet
Copy link
Member

The pb is that if you have both -std (e.g. if we put it in the TRIQS target)
the order of the options determines the result, so it is quite confusing.
So with @Wentzell, we thought not to put -std in lib, c++2py ...

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

3 participants