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 Add some builtins



details:   https://anonhg.NetBSD.org/src/rev/512d1665fb58
branches:  trunk
changeset: 795547:512d1665fb58
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 18 01:15:07 2014 +0000

description:
Add some builtins

diffstat:

 usr.bin/xlint/lint1/main1.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (55 lines):

diff -r 3ac654b8c70c -r 512d1665fb58 usr.bin/xlint/lint1/main1.c
--- a/usr.bin/xlint/lint1/main1.c       Fri Apr 18 00:37:46 2014 +0000
+++ b/usr.bin/xlint/lint1/main1.c       Fri Apr 18 01:15:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main1.c,v 1.21 2013/04/19 17:43:05 christos Exp $      */
+/*     $NetBSD: main1.c,v 1.22 2014/04/18 01:15:07 christos Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.21 2013/04/19 17:43:05 christos Exp $");
+__RCSID("$NetBSD: main1.c,v 1.22 2014/04/18 01:15:07 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -128,7 +128,11 @@
 
 static void    usage(void);
 
-int main(int, char *[]);
+static const char builtins[] =
+    "int __builtin_isinf(long double);\n"
+    "int __builtin_isnan(long double);\n"
+    "int __builtin_copysign(long double, long double);\n"
+;
 
 /*ARGSUSED*/
 static void
@@ -203,9 +207,6 @@
        if (argc != 2)
                usage();
 
-       /* open the input file */
-       if ((yyin = fopen(argv[0], "r")) == NULL)
-               err(1, "cannot open '%s'", argv[0]);
 
        /* initialize output */
        outopen(argv[1]);
@@ -219,6 +220,13 @@
        initscan();
        initmtab();
 
+       if ((yyin = fmemopen(__UNCONST(builtins), sizeof(builtins) - 1, "r"))
+           == NULL)
+               err(1, "cannot open builtins");
+       yyparse();
+       /* open the input file */
+       if ((yyin = fopen(argv[0], "r")) == NULL)
+               err(1, "cannot open '%s'", argv[0]);
        yyparse();
 
        /* Following warnings cannot be suppressed by LINTED */



Home | Main Index | Thread Index | Old Index