summaryrefslogtreecommitdiff
path: root/regress/compiler
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-10-22 07:52:27 +0000
committerrillig <rillig@pkgsrc.org>2006-10-22 07:52:27 +0000
commitffdbebc0f1f914eea0dbb03841b16986cf967816 (patch)
tree20e6bb814a0a61590d9189b86c6ef867f48d9cda /regress/compiler
parent2c2b54f2d8a28a1d53f79fe9c38e03534376a935 (diff)
downloadpkgsrc-ffdbebc0f1f914eea0dbb03841b16986cf967816.tar.gz
Added tests for macro definitions on the command line.
Diffstat (limited to 'regress/compiler')
-rw-r--r--regress/compiler/Makefile20
-rw-r--r--regress/compiler/files/checklen.c11
-rw-r--r--regress/compiler/files/checktype.c1
3 files changed, 27 insertions, 5 deletions
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 <assert.h>
+#include <string.h>
+
+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;