summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cc/cpp
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1994-11-15 04:52:19 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1994-11-15 04:52:19 +0000
commit8ab1d79d165e6fe313540017143ca389d27a020d (patch)
treecf95ec03f06accade4e1638056fb6513bccd761b /gnu/usr.bin/cc/cpp
parent4ef84c6a4e276aa5878f9dc9a6133cc8da78c4cf (diff)
Notes
Diffstat (limited to 'gnu/usr.bin/cc/cpp')
-rw-r--r--gnu/usr.bin/cc/cpp/Makefile5
-rw-r--r--gnu/usr.bin/cc/cpp/cccp.c52
2 files changed, 32 insertions, 25 deletions
diff --git a/gnu/usr.bin/cc/cpp/Makefile b/gnu/usr.bin/cc/cpp/Makefile
index 0bbc198d9d31..43ec78c3a49f 100644
--- a/gnu/usr.bin/cc/cpp/Makefile
+++ b/gnu/usr.bin/cc/cpp/Makefile
@@ -2,9 +2,10 @@
# $Id$
#
-.PATH: ${.CURDIR}/../cc_int
PROG = cpp
-SRCS = cccp.c cexp.c obstack.c version.c
+SRCS = cccp.c cexp.c
BINDIR= /usr/libexec
+.PATH: ${.CURDIR}/../cc_int
+SRCS+= obstack.c version.c
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/cc/cpp/cccp.c b/gnu/usr.bin/cc/cpp/cccp.c
index d5144669ddae..609249ba63b7 100644
--- a/gnu/usr.bin/cc/cpp/cccp.c
+++ b/gnu/usr.bin/cc/cpp/cccp.c
@@ -604,14 +604,14 @@ static struct default_include {
automatically in Makefile.in. */
{ CROSS_INCLUDE_DIR, 0, 0 },
/* This is another place that the target system's headers might be. */
- { TOOL_INCLUDE_DIR, 0, 1 },
+ { TOOL_INCLUDE_DIR, 0, 0 },
#else /* not CROSS_COMPILE */
/* This should be /usr/local/include and should come before
the fixincludes-fixed header files. */
{ LOCAL_INCLUDE_DIR, 0, 1 },
/* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */
- { TOOL_INCLUDE_DIR, 0, 1 },
+ { TOOL_INCLUDE_DIR, 0, 0 },
/* This is the dir for fixincludes. Put it just before
the files that we fix. */
{ GCC_INCLUDE_DIR, 0, 0 },
@@ -3275,10 +3275,10 @@ startagain:
/* This is now known to be a macro call.
Discard the macro name from the output,
along with any following whitespace just copied,
- but preserve newlines at the top level since this
+ but preserve newlines if not outputting marks since this
is more likely to do the right thing with line numbers. */
obp = op->buf + obufp_before_macroname;
- if (ip->macro != 0)
+ if (output_marks)
op->lineno = op_lineno_before_macroname;
else {
int newlines = op->lineno - op_lineno_before_macroname;
@@ -9031,16 +9031,18 @@ dump_single_macro (hp, of)
concat = 0;
for (ap = defn->pattern; ap != NULL; ap = ap->next) {
dump_defn_1 (defn->expansion, offset, ap->nchars, of);
- if (ap->nchars != 0)
- concat = 0;
offset += ap->nchars;
- if (ap->stringify)
- fprintf (of, " #");
- if (ap->raw_before && !concat)
- fprintf (of, " ## ");
- concat = 0;
+ if (!traditional) {
+ if (ap->nchars != 0)
+ concat = 0;
+ if (ap->stringify)
+ fprintf (of, " #");
+ if (ap->raw_before && !concat)
+ fprintf (of, " ## ");
+ concat = 0;
+ }
dump_arg_n (defn, ap->argno, of);
- if (ap->raw_after) {
+ if (!traditional && ap->raw_after) {
fprintf (of, " ## ");
concat = 1;
}
@@ -9069,7 +9071,7 @@ dump_all_macros ()
/* Output to OF a substring of a macro definition.
BASE is the beginning of the definition.
Output characters START thru LENGTH.
- Discard newlines outside of strings, thus
+ Unless traditional, discard newlines outside of strings, thus
converting funny-space markers to ordinary spaces. */
static void
@@ -9082,16 +9084,20 @@ dump_defn_1 (base, start, length, of)
U_CHAR *p = base + start;
U_CHAR *limit = base + start + length;
- while (p < limit) {
- if (*p == '\"' || *p =='\'') {
- U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR,
- NULL_PTR, NULL_PTR);
- fwrite (p, p1 - p, 1, of);
- p = p1;
- } else {
- if (*p != '\n')
- putc (*p, of);
- p++;
+ if (traditional)
+ fwrite (p, sizeof (*p), length, of);
+ else {
+ while (p < limit) {
+ if (*p == '\"' || *p =='\'') {
+ U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR,
+ NULL_PTR, NULL_PTR);
+ fwrite (p, sizeof (*p), p1 - p, of);
+ p = p1;
+ } else {
+ if (*p != '\n')
+ putc (*p, of);
+ p++;
+ }
}
}
}