Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 Handle 0b locally since anyway this is n...



details:   https://anonhg.NetBSD.org/src/rev/d93ac987ab22
branches:  trunk
changeset: 341612:d93ac987ab22
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Nov 13 16:04:58 2015 +0000

description:
Handle 0b locally since anyway this is not portable.

diffstat:

 usr.bin/xlint/lint1/scan.l |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 0fa704ce2722 -r d93ac987ab22 usr.bin/xlint/lint1/scan.l
--- a/usr.bin/xlint/lint1/scan.l        Fri Nov 13 16:04:07 2015 +0000
+++ b/usr.bin/xlint/lint1/scan.l        Fri Nov 13 16:04:58 2015 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.62 2015/11/12 17:34:01 christos Exp $ */
+/* $NetBSD: scan.l,v 1.63 2015/11/13 16:04:58 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.62 2015/11/12 17:34:01 christos Exp $");
+__RCSID("$NetBSD: scan.l,v 1.63 2015/11/13 16:04:58 christos Exp $");
 #endif
 
 #include <stdlib.h>
@@ -522,7 +522,7 @@
 {
        int     l_suffix, u_suffix;
        int     len;
-       const   char *cp;
+       const   char *cp, *sp;
        char    c, *eptr;
        tspec_t typ;
        uint64_t uq = 0;
@@ -569,7 +569,14 @@
 
        errno = 0;
 
-       uq = strtouq(cp, &eptr, base);
+       if (cp[0] == '0' && (cp[1] == 'b' || cp[1] == 'B')) {
+               sp = cp + 2;
+               base = 2;
+       } else {
+               sp = cp;
+       }
+
+       uq = strtouq(sp, &eptr, base);
        if (eptr != cp + len)
                LERROR("icon()");
        if (errno != 0)



Home | Main Index | Thread Index | Old Index