[PATCH] mkdep mishandles apostrophes in // comments

From: Mike Klar (mfklar@ponymail.com)
Date: Sat Sep 23 2000 - 17:14:13 EDT

  • Next message: safemode: "Re: Problem with 2.4.0-test9-pre6 seems to be SHM"

    Hi,

    I ran into a problem with my own kernel source files in the Linux VR project
    where 'make dep' was missing CONFIG_* dependencies for some files with C++
    style comments. It turns out that mkdep doesn't check for // at all, so it
    will misinterpret apostrophes in those comments as single quotes and ignore
    the rest of the file up to the next single quote.

    I realize some people don't much like C++ style comments in the kernel
    source, but a quick grep shows them all over the place, some of which do
    have apostrophes not used as quotes. Anyway, the following patch (partly
    from Pavel Machek) appears to fix the problem. This is against current 2.4
    kernel.

    Mike Klar

    Index: scripts/mkdep.c
    ===================================================================
    RCS file: /cvsroot/linux-vr/linux/scripts/mkdep.c,v
    retrieving revision 1.1.1.5
    diff -u -d -r1.1.1.5 mkdep.c
    --- scripts/mkdep.c 2000/07/12 08:43:00 1.1.1.5
    +++ scripts/mkdep.c 2000/09/23 21:07:44
    @@ -294,6 +294,7 @@
      * The state machine looks for (approximately) these Perl regular
    expressions:
      *
      * m|\/\*.*?\*\/|
    + * m|\/\/.*|
      * m|'.*?'|
      * m|".*?"|
      * m|#\s*include\s*"(.*?)"|
    @@ -326,9 +327,18 @@
             CASE('C', cee);
             goto start;

    +/* // */
    +slash_slash:
    + GETNEXT
    + CASE('\n', start);
    + NOTCASE('\\', slash_slash);
    + GETNEXT
    + goto slash_slash;
    +
     /* / */
     slash:
             GETNEXT
    + CASE('/', slash_slash);
             NOTCASE('*', __start);
     slash_star_dot_star:
             GETNEXT

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 17:41:15 EDT