static char *progname;
-/* Nonzero means handle C++ comment syntax and use
- extra default include directories for C++. */
+/* Nonzero means use extra default include directories for C++. */
static int cplusplus;
+/* Nonzero means handle cplusplus style comments */
+
+static int cplusplus_comments;
+
/* Nonzero means handle #import, for objective C. */
static int objc;
dump_macros = dump_none;
no_output = 0;
cplusplus = 0;
+ cplusplus_comments = 0;
bzero (pend_files, argc * sizeof (char *));
bzero (pend_defs, argc * sizeof (char *));
case 'l':
if (! strcmp (argv[i], "-lang-c"))
- cplusplus = 0, objc = 0;
+ cplusplus = 0, cplusplus_comments = 0, objc = 0;
if (! strcmp (argv[i], "-lang-c++"))
- cplusplus = 1, objc = 0;
+ cplusplus = 1, cplusplus_comments = 1, objc = 0;
if (! strcmp (argv[i], "-lang-objc"))
- objc = 1, cplusplus = 0;
+ objc = 1, cplusplus = 0, cplusplus_comments = 1;
if (! strcmp (argv[i], "-lang-objc++"))
- objc = 1, cplusplus = 1;
+ objc = 1, cplusplus = 1, cplusplus_comments = 1;
if (! strcmp (argv[i], "-lang-asm"))
lang_asm = 1;
if (! strcmp (argv[i], "-lint"))
break;
case '+':
- cplusplus = 1;
+ cplusplus = 1, cplusplus_comments = 1;
break;
case 'w':
bp++;
bp += 2;
}
- else if ((cplusplus || objc) && *bp == '/' && bp[1] == '/') {
+ else if (cplusplus_comments && *bp == '/' && bp[1] == '/') {
bp += 2;
while (*bp++ != '\n') ;
}
newline_fix (ibp);
if (*ibp != '*'
- && !((cplusplus || objc) && *ibp == '/'))
+ && !(cplusplus_comments && *ibp == '/'))
goto randomchar;
if (ip->macro != 0)
goto randomchar;
if (*bp == '\\' && bp[1] == '\n')
newline_fix (bp);
if (*bp == '*'
- || ((cplusplus || objc) && *bp == '/')) {
+ || (cplusplus_comments && *bp == '/')) {
U_CHAR *obp = bp - 1;
ip->bufp = bp + 1;
skip_to_end_of_comment (ip, &ip->lineno, 0);
case '/':
if (*xp == '*'
- || ((cplusplus || objc) && *xp == '/')) {
+ || (cplusplus_comments && *xp == '/')) {
ip->bufp = xp + 1;
/* If we already copied the command through,
already_output != 0 prevents outputting comment now. */
if (*bp == '\\' && bp[1] == '\n')
newline_fix (bp);
if (*bp == '*'
- || ((cplusplus || objc) && *bp == '/')) {
+ || (cplusplus_comments && *bp == '/')) {
ip->bufp = ++bp;
bp = skip_to_end_of_comment (ip, &ip->lineno, 0);
}
while (!(*bp == '*' && bp[1] == '/'))
bp++;
bp += 2;
- } else if ((cplusplus || objc) && *bp == '/' && bp[1] == '/') {
+ } else if (cplusplus_comments && *bp == '/' && bp[1] == '/') {
bp += 2;
while (*bp++ != '\n') ;
}
bp++;
}
bp += 2;
- } else if ((cplusplus || objc) && *bp == '/' && bp[1] == '/') {
+ } else if (cplusplus_comments && *bp == '/' && bp[1] == '/') {
bp += 2;
while (*bp++ != '\n') ;
}
p++;
}
}
- else if ((cplusplus || objc) && p[1] == '/') {
+ else if (cplusplus_comments && p[1] == '/') {
p += 2;
while (*p && *p++ != '\n') ;
}
*op->bufp++ = '/';
*op->bufp++ = '*';
}
- if ((cplusplus || objc) && bp[-1] == '/') {
+ if (cplusplus_comments && bp[-1] == '/') {
if (output) {
while (bp < limit)
if ((*op->bufp++ = *bp++) == '\n') {
case '/':
if (bp[1] == '\\' && bp[2] == '\n')
newline_fix (bp + 1);
- if ((cplusplus || objc) && bp[1] == '/') {
+ if (cplusplus_comments && bp[1] == '/') {
*comments = 1;
bp += 2;
while (bp < limit && *bp++ != '\n') ;
if (*ibp == '\\' && ibp[1] == '\n')
newline_fix (ibp);
/* Delete any comment. */
- if ((cplusplus || objc) && ibp[0] == '/') {
+ if (cplusplus_comments && ibp[0] == '/') {
obp--;
ibp++;
while (ibp < limit && *ibp++ != '\n') ;