The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/kern/genlintstub.awk

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 #       $NetBSD: genlintstub.awk,v 1.7 2003/05/20 20:25:31 kristerw Exp $
    2 #
    3 # Copyright 2001 Wasabi Systems, Inc.
    4 # All rights reserved.
    5 #
    6 # Written by Perry E. Metzger for Wasabi Systems, Inc.
    7 #
    8 # Redistribution and use in source and binary forms, with or without
    9 # modification, are permitted provided that the following conditions
   10 # are met:
   11 # 1. Redistributions of source code must retain the above copyright
   12 #    notice, this list of conditions and the following disclaimer.
   13 # 2. Redistributions in binary form must reproduce the above copyright
   14 #    notice, this list of conditions and the following disclaimer in the
   15 #    documentation and/or other materials provided with the distribution.
   16 # 3. All advertising materials mentioning features or use of this software
   17 #    must display the following acknowledgement:
   18 #      This product includes software developed for the NetBSD Project by
   19 #      Wasabi Systems, Inc.
   20 # 4. The name of Wasabi Systems, Inc. may not be used to endorse
   21 #    or promote products derived from this software without specific prior
   22 #    written permission.
   23 #
   24 # THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
   25 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   26 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   27 # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
   28 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   29 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   30 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   31 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   32 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   33 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   34 # POSSIBILITY OF SUCH DAMAGE.
   35 #
   36 
   37 # This awk script is used by kernel Makefiles to construct C lint
   38 # stubs automatically from properly formatted comments in .S files. In
   39 # general, a .S file should have a special comment for anything with
   40 # something like an ENTRY designation. The special formats are:
   41 #
   42 # /* LINTSTUB: Empty */
   43 # This is used as an indicator that the file contains no stubs at
   44 # all. It generates a /* LINTED */ comment to quiet lint.
   45 #
   46 # /* LINTSTUB: Func: type function(args) */
   47 # type must be void, int or long. A return is faked up for ints and longs.
   48 #
   49 # /* LINTSTUB: Var: type variable, variable; */
   50 # This is often appropriate for assembly bits that the rest of the
   51 # kernel has declared as char * and such, like various bits of
   52 # trampoline code.
   53 #
   54 # /* LINTSTUB: include foo */
   55 # Turns into a literal `#include foo' line in the source. Useful for
   56 # making sure the stubs are checked against system prototypes like
   57 # systm.h, cpu.h, etc., and to make sure that various types are
   58 # properly declared.
   59 #
   60 # /* LINTSTUB: Ignore */
   61 # This is used as an indicator to humans (and possible future
   62 # automatic tools) that the entry is only used internally by other .S
   63 # files and does not need a stub. You want this so you know you
   64 # haven't just forgotten to put a stub in for something and you are
   65 # *deliberately* ignoring it.
   66 
   67 BEGIN   {
   68                 printf "/* DO NOT EDIT! DO NOT EDIT! DO NOT EDIT! */\n";
   69                 printf "/* DO NOT EDIT! DO NOT EDIT! DO NOT EDIT! */\n";
   70                 printf "/* This file was automatically generated. */\n";
   71                 printf "/* see genlintstub.awk for details.       */\n";
   72                 printf "/* This file was automatically generated. */\n";
   73                 printf "/* DO NOT EDIT! DO NOT EDIT! DO NOT EDIT! */\n";
   74                 printf "/* DO NOT EDIT! DO NOT EDIT! DO NOT EDIT! */\n";
   75                 printf "\n\n";
   76         }
   77 
   78 /^\/\* LINTSTUB: Empty.*\*\/[ \t]*$/ { 
   79                 printf "/* LINTED (empty translation unit) */\n";
   80                 next;
   81         }
   82 
   83 /^\/\* LINTSTUB: Func:.*\)[ \t]*[;]?[ \t]+\*\/[ \t]*$/ { 
   84                 if (($4 == "int") || ($4 == "long"))
   85                         retflag = 1;
   86                 else if ($4 == "void")
   87                         retflag = 0;
   88                 else {
   89                         printf "ERROR: %s: type is not int or void\n", $4 > "/dev/stderr";
   90                         exit 1;
   91                 }
   92                 print "/* ARGSUSED */";
   93                 for (i = 4; i < NF; i++) {
   94                         if (i != (NF - 1))
   95                                 printf "%s ", $i;
   96                         else {
   97                                 sub(";$", "", $i);
   98                                 printf "%s\n", $i;
   99                         }
  100                 }
  101                 print "{";
  102                 if (retflag)
  103                         print "\treturn(0);"
  104                 print "}\n";
  105                 next;
  106         }
  107 
  108 /^\/\* LINTSTUB: Func:/ { 
  109           printf "ERROR: bad function declaration: %s\n", $0 > "/dev/stderr";
  110           exit 1;
  111         }
  112                         
  113 /^\/\* LINTSTUB: Var:.*[ \t]+\*\/[ \t]*$/ { 
  114                 for (i = 4; i < NF; i++) {
  115                         if (i != (NF - 1))
  116                                 printf "%s ", $i;
  117                         else {
  118                                 gsub(";$", "", $i);
  119                                 printf "%s;\n\n", $i;
  120                         }
  121                 }
  122                 next;
  123         }
  124 
  125 /^\/\* LINTSTUB: Var:/ { 
  126           printf "ERROR: bad variable declaration: %s\n", $0 > "/dev/stderr";
  127           exit 1;
  128         }
  129 
  130 /^\/\* LINTSTUB: include[ \t]+.*\*\/[ \t]*$/ {
  131                 printf "#include %s\n", $4;
  132                 next;
  133         }
  134 
  135 /^\/\* LINTSTUB: Ignore.*\*\/[ \t]*$/ { next; }
  136 
  137 /^\/\* LINTSTUB: Ignore/ { 
  138           printf "ERROR: bad ignore declaration: %s\n", $0 > "/dev/stderr";
  139           exit 1;
  140         }
  141 
  142 /^\/\* LINTSTUBS:/ { 
  143           printf "ERROR: LINTSTUB, not LINTSTUBS: %s\n", $0 > "/dev/stderr";
  144           exit 1;
  145         }
  146 
  147 /^\/\* LINTSTUB:/ { 
  148           printf "ERROR: bad declaration: %s\n", $0 > "/dev/stderr";
  149           exit 1;
  150         }

Cache object: 56dde0955e06b189d8c2007329223531


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.