From b70dacabdcd437f335e7200eb0eacd195eb34806 Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 22 Oct 2006 07:52:27 +0000 Subject: Added tests for macro definitions on the command line. --- regress/compiler/Makefile | 20 +++++++++++++++----- regress/compiler/files/checklen.c | 11 +++++++++++ regress/compiler/files/checktype.c | 1 + 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 regress/compiler/files/checklen.c create mode 100644 regress/compiler/files/checktype.c diff --git a/regress/compiler/Makefile b/regress/compiler/Makefile index 431f486721a..7e572d05f7a 100644 --- a/regress/compiler/Makefile +++ b/regress/compiler/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.1 2006/07/11 05:03:11 rillig Exp $ +# $NetBSD: Makefile,v 1.2 2006/10/22 07:52:27 rillig Exp $ # -DISTNAME= compiler-1.0 +DISTNAME= compiler-1.1 CATEGORIES= regress MASTER_SITES= # none DISTFILES= # none @@ -15,11 +15,21 @@ USE_TOOLS+= printf SRC_CMD= ${PRINTF} '\#if defined(__cplusplus)\nLANG: Cplus\n\#else\nLANG: Cplain\n\#endif\n' +do-extract: + cd ${FILESDIR} && cp *.c ${WRKSRC} + do-build: # Test whether CPP is a C preprocessor. - ${SRC_CMD} | ${CPP} -DLANG=Cplain + ${SRC_CMD} | cpp -DLANG=Cplain # Test whether CXXCPP is a C++ preprocessor. # CXXCPP is not (yet)? defined. - #${SRC_CMD} | ${CXXCPP} -DLANG=Cplus - + #${SRC_CMD} | cxxcpp -DLANG=Cplus + # Test whether white-space is preserved in macro definitions. + cd ${WRKSRC} && cc checklen.c -o checklen -DLEN=4 -DSPACES=\"\ \ \ \ \" && ./checklen + cd ${WRKSRC} && cc checklen.c -o checklen -DLEN=4 -DSPACES=\"" \"" && ./checklen + cd ${WRKSRC} && cc checklen.c -o checklen -DLEN=4 -DSPACES='" "' && ./checklen + # Test whether backslashes are preserved in macro definitions. + cd ${WRKSRC} && cc -c checktype.c -DTYPE="unsigned long" + cd ${WRKSRC} && cc -c checktype.c -DTYPE=unsigned\ long + .include "../../mk/bsd.pkg.mk" diff --git a/regress/compiler/files/checklen.c b/regress/compiler/files/checklen.c new file mode 100644 index 00000000000..92b91acafd4 --- /dev/null +++ b/regress/compiler/files/checklen.c @@ -0,0 +1,11 @@ +#include +#include + +int +main(void) +{ + const char *s = SPACES; + + assert(strlen(s) == LEN); + return 0; +} diff --git a/regress/compiler/files/checktype.c b/regress/compiler/files/checktype.c new file mode 100644 index 00000000000..5c13fc7de61 --- /dev/null +++ b/regress/compiler/files/checktype.c @@ -0,0 +1 @@ +typedef TYPE t; -- cgit v1.2.3