C++: issue a better CPP guard and Doxygen file command

Currently we use "<dir><api.location.file>" as \file argument, and as
base for the CPP guard.  This is not nice when <dir> is absolute, in
which case it is expected that the user will use api.location.include
to get something nicer.  If defined, use that name instead.

* data/location.cc (b4_location_path): New.
Use it.
* tests/c++.at (Shared locations): Check the guard and Doxygen doc.
This commit is contained in:
Akim Demaille
2018-10-09 18:58:50 +02:00
parent 67521bc0e8
commit b8351d06f1
2 changed files with 32 additions and 6 deletions

View File

@@ -1324,6 +1324,8 @@ AT_FOR_EACH_CXX([AT_COMPILE_CXX([[input]])])
AT_CLEANUP
## ------------------ ##
## Shared locations. ##
## ------------------ ##
@@ -1368,6 +1370,15 @@ AT_TEST([x1],
%define api.location.file "include/ast/loc.hh"
%define api.location.include {<ast/loc.hh>}])
# Check the CPP guard and Doxyen comments.
AT_CHECK([sed -ne '/INCLUDED/p;/\\file/{p;n;p;}' include/ast/loc.hh], [],
[[ ** \file ast/loc.hh
** Define the x1::location class.
#ifndef YY_YY_AST_LOC_HH_INCLUDED
# define YY_YY_AST_LOC_HH_INCLUDED
#endif // !YY_YY_AST_LOC_HH_INCLUDED
]])
AT_TEST([x2],
[%defines
%locations