FreeBSD Bugzilla – Attachment 9131 Details for
Bug 18821
lint does not understand C++-style comments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.96 KB, created by
tms2
on 2000-05-26 04:10:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
tms2
Created:
2000-05-26 04:10:01 UTC
Size:
3.96 KB
patch
obsolete
>*** scan.l.orig Thu May 25 21:00:46 2000 >--- scan.l Thu May 25 21:49:15 2000 >*************** >*** 50,55 **** >--- 50,58 ---- > > #define CHAR_MASK (~(~0 << CHAR_BIT)) > >+ #define C_STYLE 1 >+ #define CPP_STYLE 2 >+ > /* XXX declaration of strtouq() is missing in stdlib.h ? */ > extern u_quad_t strtouq __P((const char *, char **, int)); > >*************** >*** 78,84 **** > static int wccon __P((void)); > static int getescc __P((int)); > static void directive __P((void)); >! static void comment __P((void)); > static int string __P((void)); > static int wcstrg __P((void)); > >--- 81,87 ---- > static int wccon __P((void)); > static int getescc __P((int)); > static void directive __P((void)); >! static void comment __P((int)); > static int string __P((void)); > static int wcstrg __P((void)); > >*************** >*** 153,159 **** > ^#.*$ directive(); > \n incline(); > \t|" "|\f|\v ; >! "/*" comment(); > . badchar(yytext[0]); > > %% >--- 156,163 ---- > ^#.*$ directive(); > \n incline(); > \t|" "|\f|\v ; >! "/*" comment(C_STYLE); >! "//" comment(CPP_STYLE); > . badchar(yytext[0]); > > %% >*************** >*** 1003,1009 **** > * parsed and a function which handles this comment is called. > */ > static void >! comment() > { > int c, lc; > static struct { >--- 1007,1013 ---- > * parsed and a function which handles this comment is called. > */ > static void >! comment(int style) > { > int c, lc; > static struct { >*************** >*** 1035,1041 **** > eoc = 0; > > /* Skip white spaces after the start of the comment */ >! while ((c = inpc()) != EOF && isspace(c)) ; > > /* Read the potential keyword to keywd */ > l = 0; >--- 1039,1054 ---- > eoc = 0; > > /* Skip white spaces after the start of the comment */ >! if ( style == C_STYLE ) { >! while ((c = inpc()) != EOF && isspace(c)) ; >! } >! else { >! while ((c = inpc()) != EOF && c != '\n' && isspace(c)) ; >! if ( c == '\n' ) { >! eoc = 1; >! goto skip_rest; >! } >! } > > /* Read the potential keyword to keywd */ > l = 0; >*************** >*** 1054,1062 **** > goto skip_rest; > > /* skip white spaces after the keyword */ >! while (c != EOF && isspace(c)) >! c = inpc(); >! > /* read the argument, if the keyword accepts one and there is one */ > l = 0; > if (keywtab[i].arg) { >--- 1067,1081 ---- > goto skip_rest; > > /* skip white spaces after the keyword */ >! if ( style == C_STYLE ) { >! while (c != EOF && isspace(c)) >! c = inpc(); >! } >! else { >! while (c != EOF && c != '\n' && isspace(c)) >! c = inpc(); >! } >! > /* read the argument, if the keyword accepts one and there is one */ > l = 0; > if (keywtab[i].arg) { >*************** >*** 1069,1078 **** > a = l != 0 ? atoi(arg) : -1; > > /* skip white spaces after the argument */ >! while (c != EOF && isspace(c)) >! c = inpc(); > >! if (c != '*' || (c = inpc()) != '/') { > if (keywtab[i].func != linted) > /* extra characters in lint comment */ > warning(257); >--- 1088,1104 ---- > a = l != 0 ? atoi(arg) : -1; > > /* skip white spaces after the argument */ >! if ( style == C_STYLE ) { >! while (c != EOF && isspace(c)) >! c = inpc(); >! } >! else { >! while (c != EOF && c != '\n' && isspace(c)) >! c = inpc(); >! } > >! if ( (style == C_STYLE && (c != '*' || (c = inpc()) != '/')) >! || (style == CPP_STYLE && c != '\n') ) { > if (keywtab[i].func != linted) > /* extra characters in lint comment */ > warning(257); >*************** >*** 1088,1102 **** > (*keywtab[i].func)(a); > > skip_rest: >! while (!eoc) { >! lc = c; >! if ((c = inpc()) == EOF) { >! /* unterminated comment */ >! error(256); >! break; > } >! if (lc == '*' && c == '/') >! eoc = 1; > } > } > >--- 1114,1133 ---- > (*keywtab[i].func)(a); > > skip_rest: >! if ( style == C_STYLE ) { >! while (!eoc) { >! lc = c; >! if ((c = inpc()) == EOF) { >! /* unterminated comment */ >! error(256); >! break; >! } >! if (lc == '*' && c == '/') >! eoc = 1; > } >! } >! else { >! while ( (c = inpc()) != '\n' ) ; > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 18821
: 9131