Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/config - add RCSID's



details:   https://anonhg.NetBSD.org/src/rev/e455deb2568b
branches:  trunk
changeset: 803473:e455deb2568b
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Oct 29 17:14:50 2014 +0000

description:
- add RCSID's
- fix -Wconversion (except scanner)

diffstat:

 usr.bin/config/Makefile     |   5 ++-
 usr.bin/config/defs.h       |  12 ++++----
 usr.bin/config/files.c      |  13 +++++---
 usr.bin/config/gram.y       |  61 ++++++++++++++++++++++++++++----------------
 usr.bin/config/hash.c       |  15 ++++++----
 usr.bin/config/lint.c       |   5 ++-
 usr.bin/config/main.c       |  14 ++++++---
 usr.bin/config/mkdevsw.c    |   9 +++++-
 usr.bin/config/mkheaders.c  |  15 +++++++---
 usr.bin/config/mkioconf.c   |   7 +++-
 usr.bin/config/mkmakefile.c |   7 +++-
 usr.bin/config/mkswap.c     |   9 ++++--
 usr.bin/config/pack.c       |   7 +++-
 usr.bin/config/scan.l       |   9 ++++--
 usr.bin/config/sem.c        |  29 ++++++++++++++------
 usr.bin/config/sem.h        |   4 +-
 usr.bin/config/util.c       |   5 ++-
 17 files changed, 149 insertions(+), 77 deletions(-)

diffs (truncated from 803 to 300 lines):

diff -r 69085cd7cce0 -r e455deb2568b usr.bin/config/Makefile
--- a/usr.bin/config/Makefile   Wed Oct 29 16:24:32 2014 +0000
+++ b/usr.bin/config/Makefile   Wed Oct 29 17:14:50 2014 +0000
@@ -1,7 +1,8 @@
-#      $NetBSD: Makefile,v 1.8 2007/05/13 20:22:45 veego Exp $
+#      $NetBSD: Makefile,v 1.9 2014/10/29 17:14:50 christos Exp $
 #      from: @(#)Makefile      8.2 (Berkeley) 4/19/94
 
 .include <bsd.own.mk>
+WARNS=6
 
 PROG=  config
 SRCS=  files.c gram.y hash.c lint.c main.c mkdevsw.c mkheaders.c mkioconf.c \
@@ -21,6 +22,8 @@
 DPADD+=${LIBUTIL}
 .endif
 
+COPTS.scan.c+=-Wno-conversion
+
 CWARNFLAGS+=-Wno-format-y2k
 
 .include <bsd.prog.mk>
diff -r 69085cd7cce0 -r e455deb2568b usr.bin/config/defs.h
--- a/usr.bin/config/defs.h     Wed Oct 29 16:24:32 2014 +0000
+++ b/usr.bin/config/defs.h     Wed Oct 29 17:14:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.58 2014/10/18 06:36:40 uebayasi Exp $       */
+/*     $NetBSD: defs.h,v 1.59 2014/10/29 17:14:50 christos Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -304,8 +304,8 @@
 
        /* created during packing or ioconf.c generation */
        short   i_collapsed;    /* set => this alias no longer needed */
-       short   i_cfindex;      /* our index in cfdata */
-       short   i_locoff;       /* offset in locators.vec */
+       u_short i_cfindex;      /* our index in cfdata */
+       int     i_locoff;       /* offset in locators.vec */
 
 };
 /* special units */
@@ -530,8 +530,8 @@
 int    fixfiles(void);         /* finalize */
 int    fixobjects(void);
 int    fixdevsw(void);
-void   addfile(const char *, struct condexpr *, int, const char *);
-void   addobject(const char *, struct condexpr *, int);
+void   addfile(const char *, struct condexpr *, u_char, const char *);
+void   addobject(const char *, struct condexpr *, u_char);
 int    expr_eval(struct condexpr *, int (*)(const char *, void *), void *);
 
 /* hash.c */
@@ -625,7 +625,7 @@
 void   pack(void);
 
 /* scan.l */
-int    currentline(void);
+u_short        currentline(void);
 int    firstfile(const char *);
 void   package(const char *);
 int    include(const char *, int, int, int);
diff -r 69085cd7cce0 -r e455deb2568b usr.bin/config/files.c
--- a/usr.bin/config/files.c    Wed Oct 29 16:24:32 2014 +0000
+++ b/usr.bin/config/files.c    Wed Oct 29 17:14:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: files.c,v 1.16 2014/10/09 19:27:04 uebayasi Exp $      */
+/*     $NetBSD: files.c,v 1.17 2014/10/29 17:14:50 christos Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: files.c,v 1.17 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <errno.h>
 #include <stdio.h>
@@ -83,7 +86,7 @@
 }
 
 void
-addfile(const char *path, struct condexpr *optx, int flags, const char *rule)
+addfile(const char *path, struct condexpr *optx, u_char flags, const char *rule)
 {
        struct files *fi;
        const char *dotp, *tail;
@@ -112,7 +115,7 @@
                tail++;
        dotp = strrchr(tail, '.');
        if (dotp == NULL || dotp[1] == 0 ||
-           (baselen = dotp - tail) >= sizeof(base)) {
+           (baselen = (size_t)(dotp - tail)) >= sizeof(base)) {
                cfgerror("invalid pathname `%s'", path);
                goto bad;
        }
@@ -168,7 +171,7 @@
 }
 
 void
-addobject(const char *path, struct condexpr *optx, int flags)
+addobject(const char *path, struct condexpr *optx, u_char flags)
 {
        struct objects *oi;
 
@@ -298,7 +301,7 @@
                                if (ht_replace(basetab, fi->fi_base, fi) != 1)
                                        panic("fixfiles ht_replace(%s)",
                                            fi->fi_base);
-                               ofi->fi_flags &= ~FI_SEL;
+                               ofi->fi_flags &= (u_char)~FI_SEL;
                                ofi->fi_flags |= FI_HIDDEN;
                        } else {
                                cfgxerror(fi->fi_srcfile, fi->fi_srcline,
diff -r 69085cd7cce0 -r e455deb2568b usr.bin/config/gram.y
--- a/usr.bin/config/gram.y     Wed Oct 29 16:24:32 2014 +0000
+++ b/usr.bin/config/gram.y     Wed Oct 29 17:14:50 2014 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: gram.y,v 1.43 2014/10/10 11:09:50 uebayasi Exp $       */
+/*     $NetBSD: gram.y,v 1.44 2014/10/29 17:14:50 christos Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,6 +41,9 @@
  *     from: @(#)gram.y        8.1 (Berkeley) 6/6/93
  */
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: gram.y,v 1.44 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/types.h>
 #include <sys/param.h>
 #include <ctype.h>
@@ -159,6 +162,9 @@
        const char *str;
        struct  numconst num;
        int64_t val;
+       u_char  flag;
+       devmajor_t devmajor;
+       int32_t i32;
 }
 
 %token AND AT ATTACH
@@ -187,7 +193,7 @@
 %type  <condexpr>      cond_or_expr cond_and_expr cond_prefix_expr
 %type  <condexpr>       cond_base_expr
 %type  <str>   fs_spec
-%type  <val>   fflags fflag oflags oflag
+%type  <flag>  fflags fflag oflags oflag
 %type  <str>   rule
 %type  <attr>  depend
 %type  <devb>  devbase
@@ -204,9 +210,9 @@
 %type  <str>   device_instance
 %type  <str>   attachment
 %type  <str>   value
-%type  <val>   major_minor npseudo
+%type  <val>   major_minor
 %type  <num>   signed_number
-%type  <val>   device_flags
+%type  <i32>   int32 npseudo device_flags
 %type  <str>   deffs
 %type  <list>  deffses
 %type  <defoptlist>    defopt
@@ -217,7 +223,7 @@
 %type  <str>   optfile_opt
 %type  <list>  subarches
 %type  <str>   filename stringvalue locname mkvarname
-%type  <val>   device_major_block device_major_char
+%type  <devmajor>      device_major_block device_major_char
 %type  <list>  devnodes devnodetype devnodeflags devnode_dims
 
 %%
@@ -404,12 +410,12 @@
 ;
 
 define_maxpartitions:
-       MAXPARTITIONS NUMBER            { maxpartitions = $2.val; }
+       MAXPARTITIONS int32             { maxpartitions = $2; }
 ;
 
 define_maxusers:
-       MAXUSERS NUMBER NUMBER NUMBER
-                                       { setdefmaxusers($2.val, $3.val, $4.val); }
+       MAXUSERS int32 int32 int32
+                                       { setdefmaxusers($2, $3, $4); }
 ;
 
 define_makeoptions:
@@ -432,7 +438,7 @@
 ;
 
 define_version:
-       VERSION NUMBER          { setversion($2.val); }
+       VERSION int32           { setversion($2); }
 ;
 
 /* file options: optional expression of conditions */
@@ -473,13 +479,13 @@
 /* char 55 */
 device_major_char:
          /* empty */                   { $$ = -1; }
-       | CHAR NUMBER                   { $$ = $2.val; }
+       | CHAR int32                    { $$ = $2; }
 ;
 
 /* block 33 */
 device_major_block:
          /* empty */                   { $$ = -1; }
-       | BLOCK NUMBER                  { $$ = $2.val; }
+       | BLOCK int32                   { $$ = $2; }
 ;
 
 /* device node specification */
@@ -550,11 +556,11 @@
          locname locdefault            { $$ = MK3(loc, $1, $2, 0); }
        | locname                       { $$ = MK3(loc, $1, NULL, 0); }
        | '[' locname locdefault ']'    { $$ = MK3(loc, $2, $3, 1); }
-       | locname '[' NUMBER ']'        { $$ = locarray($1, $3.val, NULL, 0); }
-       | locname '[' NUMBER ']' locdefaults
-                                       { $$ = locarray($1, $3.val, $5, 0); }
-       | '[' locname '[' NUMBER ']' locdefaults ']'
-                                       { $$ = locarray($2, $4.val, $6, 1); }
+       | locname '[' int32 ']' { $$ = locarray($1, $3, NULL, 0); }
+       | locname '[' int32 ']' locdefaults
+                                       { $$ = locarray($1, $3, $5, 0); }
+       | '[' locname '[' int32 ']' locdefaults ']'
+                                       { $$ = locarray($2, $4, $6, 1); }
 ;
 
 /* locator name */
@@ -665,7 +671,16 @@
 
 /* one major number */
 majordef:
-       devbase '=' NUMBER              { setmajor($1, $3.val); }
+       devbase '=' int32               { setmajor($1, $3); }
+;
+
+int32:
+       NUMBER  {
+               if ($1.val > INT_MAX || $1.val < INT_MIN)
+                       cfgerror("overflow %" PRId64, $1.val);
+               else
+                       $$ = (int32_t)$1.val;
+       }
 ;
 
 /************************************************************/
@@ -735,7 +750,7 @@
 ;
 
 select_maxusers:
-       MAXUSERS NUMBER                 { setmaxusers($2.val); }
+       MAXUSERS int32                  { setmaxusers($2); }
 ;
 
 select_ident:
@@ -874,8 +889,10 @@
 
 /* device for root fs or dump */
 dev_spec:
-         '?'                           { $$ = new_si(intern("?"), NODEV); }
-       | WORD                          { $$ = new_si($1, NODEV); }
+         '?'                           { $$ = new_si(intern("?"),
+                                           (long long)NODEV); }
+       | WORD                          { $$ = new_si($1,
+                                           (long long)NODEV); }
        | major_minor                   { $$ = new_si(NULL, $1); }
 ;
 
@@ -904,7 +921,7 @@
 /* number of pseudo devices to configure (which is optional) */
 npseudo:
          /* empty */                   { $$ = 1; }
-       | NUMBER                        { $$ = $1.val; }
+       | int32                         { $$ = $1; }
 ;
 
 /* name of a device to configure */
@@ -935,7 +952,7 @@
 /* optional device flags */
 device_flags:
          /* empty */                   { $$ = 0; }
-       | FLAGS NUMBER                  { $$ = $2.val; }
+       | FLAGS int32                   { $$ = $2; }
 ;
 
 /************************************************************/
diff -r 69085cd7cce0 -r e455deb2568b usr.bin/config/hash.c
--- a/usr.bin/config/hash.c     Wed Oct 29 16:24:32 2014 +0000
+++ b/usr.bin/config/hash.c     Wed Oct 29 17:14:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hash.c,v 1.10 2014/10/12 05:25:21 uebayasi Exp $       */
+/*     $NetBSD: hash.c,v 1.11 2014/10/29 17:14:50 christos Exp $       */
 



Home | Main Index | Thread Index | Old Index