support // comments if -g is given
This commit is contained in:
parent
2179a14315
commit
905f1ba6a0
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: err.c,v 1.13 2001/02/24 00:43:51 cgd Exp $ */
|
||||
/* $NetBSD: err.c,v 1.14 2001/05/24 12:10:39 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: err.c,v 1.13 2001/02/24 00:43:51 cgd Exp $");
|
||||
__RCSID("$NetBSD: err.c,v 1.14 2001/05/24 12:10:39 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#define FD_SETSIZE 512
|
||||
@ -374,6 +374,7 @@ const char *msgs[] = {
|
||||
"extra bits set to 0 in conversion of '%s' to '%s', op %s", /* 309 */
|
||||
"symbol renaming can't be used on function arguments", /* 310 */
|
||||
"symbol renaming can't be used on automatic variables", /* 311 */
|
||||
"%s C does not support // comments", /* 312 */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,5 @@
|
||||
%{
|
||||
/* $NetBSD: scan.l,v 1.17 2001/05/24 11:56:36 lukem Exp $ */
|
||||
/* $NetBSD: scan.l,v 1.18 2001/05/24 12:10:39 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: scan.l,v 1.17 2001/05/24 11:56:36 lukem Exp $");
|
||||
__RCSID("$NetBSD: scan.l,v 1.18 2001/05/24 12:10:39 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -79,6 +79,7 @@ static int wccon __P((void));
|
||||
static int getescc __P((int));
|
||||
static void directive __P((void));
|
||||
static void comment __P((void));
|
||||
static void slashslashcomment __P((void));
|
||||
static int string __P((void));
|
||||
static int wcstrg __P((void));
|
||||
|
||||
@ -154,6 +155,7 @@ EX ([eE][+-]?[0-9]+)
|
||||
\n incline();
|
||||
\t|" "|\f|\v ;
|
||||
"/*" comment();
|
||||
"//" slashslashcomment();
|
||||
. badchar(yytext[0]);
|
||||
|
||||
%%
|
||||
@ -1139,6 +1141,22 @@ comment()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle // style comments
|
||||
*/
|
||||
static void
|
||||
slashslashcomment()
|
||||
{
|
||||
int c;
|
||||
|
||||
if (sflag < 2 && !gflag)
|
||||
/* // comments only support in C99 */
|
||||
(void)gnuism(312, tflag ? "traditional" : "ANSI");
|
||||
|
||||
while ((c = inpc()) != EOF && c != '\n')
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear flags for lint comments LINTED, LONGLONG and CONSTCOND.
|
||||
* clrwflgs() is called after function definitions and global and
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: lint.1,v 1.17 2001/05/24 11:58:09 lukem Exp $
|
||||
.\" $NetBSD: lint.1,v 1.18 2001/05/24 12:12:04 lukem Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
.\" Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -241,7 +241,9 @@ Don't print warnings for some extensions of
|
||||
.Xr gcc 1
|
||||
to the C language. Currently these are nonconstant initializers in
|
||||
automatic aggregate initializations, arithmetic on pointer to void,
|
||||
trailing commas in enum declarations,
|
||||
trailing commas in enum declarations, C++ -style
|
||||
.Dq //
|
||||
comments,
|
||||
zero sized structures, subscripting of non-lvalue arrays, prototypes
|
||||
overriding old style function declarations and long long
|
||||
integer types.
|
||||
|
Loading…
Reference in New Issue
Block a user