mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 00:03:03 +00:00
tests: check that C and C++ objects can be linked together.
* tests/local.at (AT_SKIP_IF_CANNOT_LINK_C_AND_CXX): New. * tests/headers.at (Several parsers): Use it.
This commit is contained in:
@@ -683,6 +683,44 @@ m4_define([AT_FULL_COMPILE],
|
||||
])
|
||||
|
||||
|
||||
|
||||
# AT_SKIP_IF_CANNOT_LINK_C_AND_CXX
|
||||
# --------------------------------
|
||||
# Check that we can link together C and C++ objects.
|
||||
m4_define([AT_SKIP_IF_CANNOT_LINK_C_AND_CXX],
|
||||
[AT_DATA([c-and-cxx.h],
|
||||
[[#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
int fortytwo (void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
]])
|
||||
AT_DATA([c-only.c],
|
||||
[[#include "c-and-cxx.h"
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return fortytwo () == 42 ? 0 : 1;
|
||||
}
|
||||
]])
|
||||
AT_DATA([cxx-only.cc],
|
||||
[[#include "c-and-cxx.h"
|
||||
int fortytwo ()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
]])
|
||||
AT_COMPILE([c-only.o], [c-only.c])
|
||||
AT_COMPILE_CXX([cxx-only.o], [cxx-only.cc])
|
||||
AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS c-only.o cxx-only.o -o c-and-cxx ||
|
||||
exit 77], [ignore], [ignore])
|
||||
AT_CHECK([./c-and-cxx])
|
||||
])
|
||||
|
||||
|
||||
## ---------------------------- ##
|
||||
## Running a generated parser. ##
|
||||
## ---------------------------- ##
|
||||
|
||||
Reference in New Issue
Block a user