mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-23 18:25:19 +00:00
This commit was generated by cvs2svn to compensate for changes in r91586,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
675d3eb019
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91587
21
usr.bin/xlint/Makefile.inc
Normal file
21
usr.bin/xlint/Makefile.inc
Normal file
|
@ -0,0 +1,21 @@
|
|||
# $NetBSD: Makefile.inc,v 1.8 2002/02/04 00:18:32 thorpej Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
.PATH: ${.CURDIR}/../common
|
||||
|
||||
# On the m68000, MACHINE_CPU is "m68k", but we have different
|
||||
# target parameters (namely, long double is a different size
|
||||
# on the m68000), so we special case the directory name here.
|
||||
.if ${MACHINE_ARCH} == "m68000"
|
||||
ARCHSUBDIR= m68000
|
||||
.else
|
||||
ARCHSUBDIR= ${MACHINE_CPU}
|
||||
.endif
|
||||
|
||||
CPPFLAGS+= -I${.CURDIR}/../arch/${ARCHSUBDIR}
|
||||
CPPFLAGS+= -I${.CURDIR}/../common
|
||||
|
||||
.if exists(${.CURDIR}/../../Makefile.inc)
|
||||
.include "${.CURDIR}/../../Makefile.inc"
|
||||
.endif
|
53
usr.bin/xlint/arch/alpha/targparam.h
Normal file
53
usr.bin/xlint/arch/alpha/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:18 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "lp64.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 1
|
||||
#define SIZEOF_IS_ULONG 1
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (8 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/amd64/targparam.h
Normal file
53
usr.bin/xlint/arch/amd64/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.2 2002/01/30 06:55:00 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "lp64.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 1
|
||||
#define SIZEOF_IS_ULONG 1
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (16 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
63
usr.bin/xlint/arch/arm/targparam.h
Normal file
63
usr.bin/xlint/arch/arm/targparam.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:19 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#if defined(TARGET_OBJFMT_ELF)
|
||||
#define PTRDIFF_IS_LONG 1
|
||||
#define SIZEOF_IS_ULONG 1
|
||||
#else
|
||||
#define PTRDIFF_IS_LONG 0
|
||||
#define SIZEOF_IS_ULONG 0
|
||||
#endif
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (8 * CHAR_BIT)
|
||||
|
||||
#if defined(TARGET_OBJFMT_ELF)
|
||||
/* XXX ARM ELF ABI says packed enums -- variable size! */
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
||||
#else
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
||||
#endif
|
53
usr.bin/xlint/arch/i386/targparam.h
Normal file
53
usr.bin/xlint/arch/i386/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:19 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 0
|
||||
#define SIZEOF_IS_ULONG 0
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (12 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/m68000/targparam.h
Normal file
53
usr.bin/xlint/arch/m68000/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 0
|
||||
#define SIZEOF_IS_ULONG 0
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (8 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/m68k/targparam.h
Normal file
53
usr.bin/xlint/arch/m68k/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:19 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 0
|
||||
#define SIZEOF_IS_ULONG 0
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (12 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/mips/targparam.h
Normal file
53
usr.bin/xlint/arch/mips/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:19 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 0
|
||||
#define SIZEOF_IS_ULONG 0
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (8 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/ns32k/targparam.h
Normal file
53
usr.bin/xlint/arch/ns32k/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:20 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 0
|
||||
#define SIZEOF_IS_ULONG 0
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (12 * CHAR_BIT) /* XXX double-check */
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/powerpc/targparam.h
Normal file
53
usr.bin/xlint/arch/powerpc/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:20 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 0
|
||||
#define SIZEOF_IS_ULONG 0
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (8 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/sh3/targparam.h
Normal file
53
usr.bin/xlint/arch/sh3/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:20 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 0
|
||||
#define SIZEOF_IS_ULONG 0
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (8 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/sparc/targparam.h
Normal file
53
usr.bin/xlint/arch/sparc/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:21 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 1
|
||||
#define SIZEOF_IS_ULONG 1
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (8 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/sparc64/targparam.h
Normal file
53
usr.bin/xlint/arch/sparc64/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.2 2002/01/30 06:55:00 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "lp64.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 1
|
||||
#define SIZEOF_IS_ULONG 1
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (16 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/vax/targparam.h
Normal file
53
usr.bin/xlint/arch/vax/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:22 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "ilp32.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 0
|
||||
#define SIZEOF_IS_ULONG 0
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (8 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
53
usr.bin/xlint/arch/x86_64/targparam.h
Normal file
53
usr.bin/xlint/arch/x86_64/targparam.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:22 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-dependent target parameters for lint1.
|
||||
*/
|
||||
|
||||
#include "lp64.h"
|
||||
|
||||
/*
|
||||
* Should be set to 1 if the difference of two pointers is of type long
|
||||
* or the value of sizeof is of type unsigned long. Note this MUST be
|
||||
* kept in sync with the compiler!
|
||||
*/
|
||||
|
||||
#define PTRDIFF_IS_LONG 1
|
||||
#define SIZEOF_IS_ULONG 1
|
||||
|
||||
#define FLOAT_SIZE (4 * CHAR_BIT)
|
||||
#define DOUBLE_SIZE (8 * CHAR_BIT)
|
||||
#define LDOUBLE_SIZE (16 * CHAR_BIT)
|
||||
|
||||
#define ENUM_SIZE (4 * CHAR_BIT)
|
234
usr.bin/xlint/common/emit.c
Normal file
234
usr.bin/xlint/common/emit.c
Normal file
|
@ -0,0 +1,234 @@
|
|||
/* $NetBSD: emit.c,v 1.2 2002/01/21 19:49:51 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: emit.c,v 1.2 2002/01/21 19:49:51 tv Exp $");
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lint.h"
|
||||
|
||||
/* name and handle of output file */
|
||||
static const char *loname;
|
||||
static FILE *lout;
|
||||
|
||||
/* output buffer data */
|
||||
ob_t ob;
|
||||
|
||||
static void outxbuf(void);
|
||||
|
||||
|
||||
/*
|
||||
* initialize output
|
||||
*/
|
||||
void
|
||||
outopen(const char *name)
|
||||
{
|
||||
|
||||
loname = name;
|
||||
|
||||
/* Open output file */
|
||||
if ((lout = fopen(name, "w")) == NULL)
|
||||
err(1, "cannot open '%s'", name);
|
||||
|
||||
/* Create output buffer */
|
||||
ob.o_len = 1024;
|
||||
ob.o_end = (ob.o_buf = ob.o_nxt = xmalloc(ob.o_len)) + ob.o_len;
|
||||
}
|
||||
|
||||
/*
|
||||
* flush output buffer and close file
|
||||
*/
|
||||
void
|
||||
outclose(void)
|
||||
{
|
||||
|
||||
outclr();
|
||||
if (fclose(lout) == EOF)
|
||||
err(1, "cannot close '%s'", loname);
|
||||
}
|
||||
|
||||
/*
|
||||
* resize output buffer
|
||||
*/
|
||||
static void
|
||||
outxbuf(void)
|
||||
{
|
||||
ptrdiff_t coffs;
|
||||
|
||||
coffs = ob.o_nxt - ob.o_buf;
|
||||
ob.o_len *= 2;
|
||||
ob.o_end = (ob.o_buf = xrealloc(ob.o_buf, ob.o_len)) + ob.o_len;
|
||||
ob.o_nxt = ob.o_buf + coffs;
|
||||
}
|
||||
|
||||
/*
|
||||
* reset output buffer
|
||||
* if it is not empty, it is flushed
|
||||
*/
|
||||
void
|
||||
outclr(void)
|
||||
{
|
||||
size_t sz;
|
||||
|
||||
if (ob.o_buf != ob.o_nxt) {
|
||||
outchar('\n');
|
||||
sz = ob.o_nxt - ob.o_buf;
|
||||
if (sz > ob.o_len)
|
||||
errx(1, "internal error: outclr() 1");
|
||||
if (fwrite(ob.o_buf, sz, 1, lout) != 1)
|
||||
err(1, "cannot write to %s", loname);
|
||||
ob.o_nxt = ob.o_buf;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* write a character to the output buffer
|
||||
*/
|
||||
void
|
||||
outchar(int c)
|
||||
{
|
||||
|
||||
if (ob.o_nxt == ob.o_end)
|
||||
outxbuf();
|
||||
*ob.o_nxt++ = (char)c;
|
||||
}
|
||||
|
||||
/*
|
||||
* write a character to the output buffer, qouted if necessary
|
||||
*/
|
||||
void
|
||||
outqchar(int c)
|
||||
{
|
||||
|
||||
if (isprint(c) && c != '\\' && c != '"' && c != '\'') {
|
||||
outchar(c);
|
||||
} else {
|
||||
outchar('\\');
|
||||
switch (c) {
|
||||
case '\\':
|
||||
outchar('\\');
|
||||
break;
|
||||
case '"':
|
||||
outchar('"');
|
||||
break;
|
||||
case '\'':
|
||||
outchar('\'');
|
||||
break;
|
||||
case '\b':
|
||||
outchar('b');
|
||||
break;
|
||||
case '\t':
|
||||
outchar('t');
|
||||
break;
|
||||
case '\n':
|
||||
outchar('n');
|
||||
break;
|
||||
case '\f':
|
||||
outchar('f');
|
||||
break;
|
||||
case '\r':
|
||||
outchar('r');
|
||||
break;
|
||||
case '\v':
|
||||
outchar('v');
|
||||
break;
|
||||
case '\a':
|
||||
outchar('a');
|
||||
break;
|
||||
default:
|
||||
outchar((((u_int)c >> 6) & 07) + '0');
|
||||
outchar((((u_int)c >> 3) & 07) + '0');
|
||||
outchar((c & 07) + '0');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* write a strint to the output buffer
|
||||
* the string must not contain any characters which
|
||||
* should be quoted
|
||||
*/
|
||||
void
|
||||
outstrg(const char *s)
|
||||
{
|
||||
|
||||
while (*s != '\0') {
|
||||
if (ob.o_nxt == ob.o_end)
|
||||
outxbuf();
|
||||
*ob.o_nxt++ = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* write an integer value to toe output buffer
|
||||
*/
|
||||
void
|
||||
outint(int i)
|
||||
{
|
||||
|
||||
if ((ob.o_end - ob.o_nxt) < 3 * sizeof (int))
|
||||
outxbuf();
|
||||
ob.o_nxt += sprintf(ob.o_nxt, "%d", i);
|
||||
}
|
||||
|
||||
/*
|
||||
* write the name of a symbol to the output buffer
|
||||
* the name is preceded by its length
|
||||
*/
|
||||
void
|
||||
outname(const char *name)
|
||||
{
|
||||
|
||||
if (name == NULL)
|
||||
errx(1, "internal error: outname() 1");
|
||||
outint((int)strlen(name));
|
||||
outstrg(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* write the name of the .c source
|
||||
*/
|
||||
void
|
||||
outsrc(const char *name)
|
||||
{
|
||||
|
||||
outclr();
|
||||
outchar('S');
|
||||
outstrg(name);
|
||||
}
|
66
usr.bin/xlint/common/externs.h
Normal file
66
usr.bin/xlint/common/externs.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* $NetBSD: externs.h,v 1.1 2002/01/18 20:39:23 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* main[12].c
|
||||
*/
|
||||
extern int pflag;
|
||||
|
||||
/*
|
||||
* inittyp.c
|
||||
*/
|
||||
extern void inittyp(void);
|
||||
|
||||
/*
|
||||
* mem.c
|
||||
*/
|
||||
extern void *xmalloc(size_t);
|
||||
extern void *xcalloc(size_t, size_t);
|
||||
extern void *xrealloc(void *, size_t);
|
||||
extern char *xstrdup(const char *);
|
||||
extern void nomem(void);
|
||||
|
||||
/*
|
||||
* emit.c
|
||||
*/
|
||||
extern ob_t ob;
|
||||
|
||||
extern void outopen(const char *);
|
||||
extern void outclose(void);
|
||||
extern void outclr(void);
|
||||
extern void outchar(int);
|
||||
extern void outqchar(int);
|
||||
extern void outstrg(const char *);
|
||||
extern void outint(int);
|
||||
extern void outname(const char *);
|
||||
extern void outsrc(const char *);
|
59
usr.bin/xlint/common/ilp32.h
Normal file
59
usr.bin/xlint/common/ilp32.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* $NetBSD: ilp32.h,v 1.1 2002/01/18 20:39:23 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Type sizes for IPL32 platforms (int, long, pointer: 32-bit)
|
||||
*/
|
||||
|
||||
#define CHAR_SIZE (CHAR_BIT)
|
||||
#define SHORT_SIZE (2 * CHAR_BIT)
|
||||
#define INT_SIZE (4 * CHAR_BIT)
|
||||
#define LONG_SIZE (4 * CHAR_BIT)
|
||||
#define QUAD_SIZE (8 * CHAR_BIT)
|
||||
#define PTR_SIZE (4 * CHAR_BIT)
|
||||
|
||||
#define TARG_INT_MAX ((int32_t) (((uint32_t) -1) >> 1))
|
||||
#define TARG_INT_MIN ((-TARG_INT_MAX) - 1)
|
||||
#define TARG_UINT_MAX ((uint32_t) -1)
|
||||
|
||||
#define TARG_LONG_MAX TARG_INT_MAX
|
||||
#define TARG_LONG_MIN TARG_INT_MIN
|
||||
#define TARG_ULONG_MAX TARG_UINT_MAX
|
||||
|
||||
#define TARG_QUAD_MAX ((int64_t) (((uint64_t) -1) >> 1))
|
||||
#define TARG_QUAD_MIN ((-TARG_QUAD_MAX) - 1)
|
||||
#define TARG_UQUAD_MAX ((uint64_t) -1)
|
133
usr.bin/xlint/common/inittyp.c
Normal file
133
usr.bin/xlint/common/inittyp.c
Normal file
|
@ -0,0 +1,133 @@
|
|||
/* $NetBSD: inittyp.c,v 1.3 2002/01/30 06:55:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: inittyp.c,v 1.3 2002/01/30 06:55:02 thorpej Exp $");
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lint.h"
|
||||
|
||||
/* various type information */
|
||||
ttab_t ttab[NTSPEC];
|
||||
|
||||
void
|
||||
inittyp(void)
|
||||
{
|
||||
int i;
|
||||
static const struct {
|
||||
tspec_t it_tspec;
|
||||
ttab_t it_ttab;
|
||||
} ittab[NTSPEC] = {
|
||||
{ SIGNED, { 0, 0,
|
||||
SIGNED, UNSIGN,
|
||||
0, 0, 0, 0, 0, "signed" } },
|
||||
{ UNSIGN, { 0, 0,
|
||||
SIGNED, UNSIGN,
|
||||
0, 0, 0, 0, 0, "unsigned" } },
|
||||
{ CHAR, { CHAR_SIZE, CHAR_BIT,
|
||||
SCHAR, UCHAR,
|
||||
1, 0, 0, 1, 1, "char" } },
|
||||
{ SCHAR, { CHAR_SIZE, CHAR_BIT,
|
||||
SCHAR, UCHAR,
|
||||
1, 0, 0, 1, 1, "signed char" } },
|
||||
{ UCHAR, { CHAR_SIZE, CHAR_BIT,
|
||||
SCHAR, UCHAR,
|
||||
1, 1, 0, 1, 1, "unsigned char" } },
|
||||
{ SHORT, { SHORT_SIZE, 2 * CHAR_BIT,
|
||||
SHORT, USHORT,
|
||||
1, 0, 0, 1, 1, "short" } },
|
||||
{ USHORT, { SHORT_SIZE, 2 * CHAR_BIT,
|
||||
SHORT, USHORT,
|
||||
1, 1, 0, 1, 1, "unsigned short" } },
|
||||
{ INT, { INT_SIZE, 3 * CHAR_BIT,
|
||||
INT, UINT,
|
||||
1, 0, 0, 1, 1, "int" } },
|
||||
{ UINT, { INT_SIZE, 3 * CHAR_BIT,
|
||||
INT, UINT,
|
||||
1, 1, 0, 1, 1, "unsigned int" } },
|
||||
{ LONG, { LONG_SIZE, 4 * CHAR_BIT,
|
||||
LONG, ULONG,
|
||||
1, 0, 0, 1, 1, "long" } },
|
||||
{ ULONG, { LONG_SIZE, 4 * CHAR_BIT,
|
||||
LONG, ULONG,
|
||||
1, 1, 0, 1, 1, "unsigned long" } },
|
||||
{ QUAD, { QUAD_SIZE, 8 * CHAR_BIT,
|
||||
QUAD, UQUAD,
|
||||
1, 0, 0, 1, 1, "long long" } },
|
||||
{ UQUAD, { QUAD_SIZE, 8 * CHAR_BIT,
|
||||
QUAD, UQUAD,
|
||||
1, 1, 0, 1, 1, "unsigned long long" } },
|
||||
{ FLOAT, { FLOAT_SIZE, 4 * CHAR_BIT,
|
||||
FLOAT, FLOAT,
|
||||
0, 0, 1, 1, 1, "float" } },
|
||||
{ DOUBLE, { DOUBLE_SIZE, 8 * CHAR_BIT,
|
||||
DOUBLE, DOUBLE,
|
||||
0, 0, 1, 1, 1, "double" } },
|
||||
{ LDOUBLE, { LDOUBLE_SIZE, 10 * CHAR_BIT,
|
||||
LDOUBLE, LDOUBLE,
|
||||
0, 0, 1, 1, 1, "long double" } },
|
||||
{ VOID, { -1, -1,
|
||||
VOID, VOID,
|
||||
0, 0, 0, 0, 0, "void" } },
|
||||
{ STRUCT, { -1, -1,
|
||||
STRUCT, STRUCT,
|
||||
0, 0, 0, 0, 0, "struct" } },
|
||||
{ UNION, { -1, -1,
|
||||
UNION, UNION,
|
||||
0, 0, 0, 0, 0, "union" } },
|
||||
{ ENUM, { ENUM_SIZE, 3 * CHAR_BIT,
|
||||
ENUM, ENUM,
|
||||
1, 0, 0, 1, 1, "enum" } },
|
||||
{ PTR, { PTR_SIZE, 4 * CHAR_BIT,
|
||||
PTR, PTR,
|
||||
0, 1, 0, 0, 1, "pointer" } },
|
||||
{ ARRAY, { -1, -1,
|
||||
ARRAY, ARRAY,
|
||||
0, 0, 0, 0, 0, "array" } },
|
||||
{ FUNC, { -1, -1,
|
||||
FUNC, FUNC,
|
||||
0, 0, 0, 0, 0, "function" } },
|
||||
};
|
||||
|
||||
for (i = 0; i < sizeof (ittab) / sizeof (ittab[0]); i++)
|
||||
STRUCT_ASSIGN(ttab[ittab[i].it_tspec], ittab[i].it_ttab);
|
||||
if (!pflag) {
|
||||
for (i = 0; i < NTSPEC; i++)
|
||||
ttab[i].tt_psz = ttab[i].tt_sz;
|
||||
}
|
||||
}
|
126
usr.bin/xlint/common/lint.h
Normal file
126
usr.bin/xlint/common/lint.h
Normal file
|
@ -0,0 +1,126 @@
|
|||
/* $NetBSD: lint.h,v 1.3 2002/01/31 22:44:00 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#else
|
||||
#define HAVE_DECL_SYS_SIGNAME 1
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <err.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "param.h"
|
||||
|
||||
/*
|
||||
* Type specifiers, used in type structures (type_t) and otherwere.
|
||||
*/
|
||||
typedef enum {
|
||||
NOTSPEC = 0,
|
||||
SIGNED, /* keyword "signed", only used in the parser */
|
||||
UNSIGN, /* keyword "unsigned", only used in the parser */
|
||||
CHAR, /* char */
|
||||
SCHAR, /* signed char */
|
||||
UCHAR, /* unsigned char */
|
||||
SHORT, /* (signed) short */
|
||||
USHORT, /* unsigned short */
|
||||
INT, /* (signed) int */
|
||||
UINT, /* unsigned int */
|
||||
LONG, /* (signed) long */
|
||||
ULONG, /* unsigned long */
|
||||
QUAD, /* (signed) long long */
|
||||
UQUAD, /* unsigned long long */
|
||||
FLOAT, /* float */
|
||||
DOUBLE, /* double or, with tflag, long float */
|
||||
LDOUBLE, /* long double */
|
||||
VOID, /* void */
|
||||
STRUCT, /* structure tag */
|
||||
UNION, /* union tag */
|
||||
ENUM, /* enum tag */
|
||||
PTR, /* pointer */
|
||||
ARRAY, /* array */
|
||||
FUNC, /* function */
|
||||
NTSPEC
|
||||
} tspec_t;
|
||||
|
||||
/*
|
||||
* size of types, name and classification
|
||||
*/
|
||||
typedef struct {
|
||||
int tt_sz; /* size in bits */
|
||||
int tt_psz; /* size, different from tt_sz
|
||||
if pflag is set */
|
||||
tspec_t tt_styp; /* signed counterpart */
|
||||
tspec_t tt_utyp; /* unsigned counterpart */
|
||||
u_int tt_isityp : 1; /* 1 if integer type */
|
||||
u_int tt_isutyp : 1; /* 1 if unsigned integer type */
|
||||
u_int tt_isftyp : 1; /* 1 if floating point type */
|
||||
u_int tt_isatyp : 1; /* 1 if arithmetic type */
|
||||
u_int tt_issclt : 1; /* 1 if scalar type */
|
||||
char *tt_name; /* Bezeichnung des Typs */
|
||||
} ttab_t;
|
||||
|
||||
#define size(t) (ttab[t].tt_sz)
|
||||
#define psize(t) (ttab[t].tt_psz)
|
||||
#define styp(t) (ttab[t].tt_styp)
|
||||
#define utyp(t) (ttab[t].tt_utyp)
|
||||
#define isityp(t) (ttab[t].tt_isityp)
|
||||
#define isutyp(t) (ttab[t].tt_isutyp)
|
||||
#define isftyp(t) (ttab[t].tt_isftyp)
|
||||
#define isatyp(t) (ttab[t].tt_isatyp)
|
||||
#define issclt(t) (ttab[t].tt_issclt)
|
||||
|
||||
extern ttab_t ttab[];
|
||||
|
||||
|
||||
typedef enum {
|
||||
NODECL, /* until now not declared */
|
||||
DECL, /* declared */
|
||||
TDEF, /* tentative defined */
|
||||
DEF /* defined */
|
||||
} def_t;
|
||||
|
||||
/*
|
||||
* Following structure contains some data used for the output buffer.
|
||||
*/
|
||||
typedef struct ob {
|
||||
char *o_buf; /* buffer */
|
||||
char *o_end; /* first byte after buffer */
|
||||
size_t o_len; /* length of buffer */
|
||||
char *o_nxt; /* next free byte in buffer */
|
||||
} ob_t;
|
||||
|
||||
#include "externs.h"
|
59
usr.bin/xlint/common/lp64.h
Normal file
59
usr.bin/xlint/common/lp64.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* $NetBSD: lp64.h,v 1.1 2002/01/18 20:39:23 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Type sizes for LP64 platforms (long, pointer: 64-bit)
|
||||
*/
|
||||
|
||||
#define CHAR_SIZE (CHAR_BIT)
|
||||
#define SHORT_SIZE (2 * CHAR_BIT)
|
||||
#define INT_SIZE (4 * CHAR_BIT)
|
||||
#define LONG_SIZE (8 * CHAR_BIT)
|
||||
#define QUAD_SIZE (8 * CHAR_BIT)
|
||||
#define PTR_SIZE (8 * CHAR_BIT)
|
||||
|
||||
#define TARG_INT_MAX ((int32_t) (((uint32_t) -1) >> 1))
|
||||
#define TARG_INT_MIN ((-TARG_INT_MAX) - 1)
|
||||
#define TARG_UINT_MAX ((uint32_t) -1)
|
||||
|
||||
#define TARG_QUAD_MAX ((int64_t) (((uint64_t) -1) >> 1))
|
||||
#define TARG_QUAD_MIN ((-TARG_QUAD_MAX) - 1)
|
||||
#define TARG_UQUAD_MAX ((uint64_t) -1)
|
||||
|
||||
#define TARG_LONG_MAX TARG_QUAD_MAX
|
||||
#define TARG_LONG_MIN TARG_QUAD_MIN
|
||||
#define TARG_ULONG_MAX TARG_UQUAD_MAX
|
88
usr.bin/xlint/common/mem.c
Normal file
88
usr.bin/xlint/common/mem.c
Normal file
|
@ -0,0 +1,88 @@
|
|||
/* $NetBSD: mem.c,v 1.2 2002/01/21 19:49:51 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: mem.c,v 1.2 2002/01/21 19:49:51 tv Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lint.h"
|
||||
|
||||
void *
|
||||
xmalloc(size_t s)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if ((p = malloc(s)) == NULL)
|
||||
nomem();
|
||||
return (p);
|
||||
}
|
||||
|
||||
void *
|
||||
xcalloc(size_t n, size_t s)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if ((p = calloc(n, s)) == NULL)
|
||||
nomem();
|
||||
return (p);
|
||||
}
|
||||
|
||||
void *
|
||||
xrealloc(void *p, size_t s)
|
||||
{
|
||||
|
||||
if ((p = realloc(p, s)) == NULL)
|
||||
nomem();
|
||||
return (p);
|
||||
}
|
||||
|
||||
char *
|
||||
xstrdup(const char *s)
|
||||
{
|
||||
char *s2;
|
||||
|
||||
if ((s2 = strdup(s)) == NULL)
|
||||
nomem();
|
||||
return (s2);
|
||||
}
|
||||
|
||||
void
|
||||
nomem(void)
|
||||
{
|
||||
|
||||
errx(1, "virtual memory exhausted");
|
||||
}
|
88
usr.bin/xlint/common/param.h
Normal file
88
usr.bin/xlint/common/param.h
Normal file
|
@ -0,0 +1,88 @@
|
|||
/* $NetBSD: param.h,v 1.1 2002/01/18 20:39:24 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jochen Pohl for
|
||||
* The NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Minimun size of string buffer. If this is not enough, the buffer
|
||||
* is enlarged in steps of STRBLEN bytes.
|
||||
*/
|
||||
#define STRBLEN 256
|
||||
|
||||
/*
|
||||
* This defines the size of memory blocks which are used to allocate
|
||||
* memory in larger chunks.
|
||||
*/
|
||||
#define MBLKSIZ ((size_t)0x4000)
|
||||
|
||||
/*
|
||||
* Sizes of hash tables
|
||||
* Should be a prime. Possible primes are
|
||||
* 307, 401, 503, 601, 701, 809, 907, 1009, 1103, 1201, 1301, 1409, 1511.
|
||||
*
|
||||
* HSHSIZ1 symbol table 1st pass
|
||||
* HSHSIZ2 symbol table 2nd pass
|
||||
* THSHSIZ2 type table 2nd pass
|
||||
*/
|
||||
#define HSHSIZ1 503
|
||||
#define HSHSIZ2 1009
|
||||
#define THSHSIZ2 1009
|
||||
|
||||
/*
|
||||
* Pull in target-specific parameters.
|
||||
*/
|
||||
#include "targparam.h"
|
||||
|
||||
/*
|
||||
* Make sure this matches wchar_t.
|
||||
*/
|
||||
#define WCHAR INT
|
||||
|
||||
/*
|
||||
* long double only in ANSI C.
|
||||
*
|
||||
* And the sparc64 long double code generation is broken.
|
||||
*/
|
||||
#if !defined(__sparc64__) && defined(__STDC__)
|
||||
typedef long double ldbl_t;
|
||||
#else
|
||||
typedef double ldbl_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some traditional compilers are not able to assign structures.
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
#define STRUCT_ASSIGN(dest, src) (dest) = (src)
|
||||
#else
|
||||
#define STRUCT_ASSIGN(dest, src) (void)memcpy(&(dest), &(src), \
|
||||
sizeof (dest));
|
||||
#endif
|
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: emit1.c,v 1.4 1995/10/02 17:21:28 jpo Exp $ */
|
||||
/* $NetBSD: emit1.c,v 1.11 2002/01/31 19:36:54 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
|
@ -31,16 +32,17 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: emit1.c,v 1.4 1995/10/02 17:21:28 jpo Exp $";
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: emit1.c,v 1.11 2002/01/31 19:36:54 tv Exp $");
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "lint1.h"
|
||||
|
||||
static void outtt __P((sym_t *, sym_t *));
|
||||
static void outfstrg __P((strg_t *));
|
||||
static void outtt(sym_t *, sym_t *);
|
||||
static void outfstrg(strg_t *);
|
||||
|
||||
/*
|
||||
* Write type into the output buffer.
|
||||
|
@ -82,8 +84,7 @@ static void outfstrg __P((strg_t *));
|
|||
* and 'v' (for volatile)
|
||||
*/
|
||||
void
|
||||
outtype(tp)
|
||||
type_t *tp;
|
||||
outtype(type_t *tp)
|
||||
{
|
||||
int t, s, na;
|
||||
sym_t *arg;
|
||||
|
@ -153,8 +154,7 @@ outtype(tp)
|
|||
* it uses its own output buffer for conversion
|
||||
*/
|
||||
const char *
|
||||
ttos(tp)
|
||||
type_t *tp;
|
||||
ttos(type_t *tp)
|
||||
{
|
||||
static ob_t tob;
|
||||
ob_t tmp;
|
||||
|
@ -184,9 +184,12 @@ ttos(tp)
|
|||
* refers to this tag, this typename is written
|
||||
*/
|
||||
static void
|
||||
outtt(tag, tdef)
|
||||
sym_t *tag, *tdef;
|
||||
outtt(sym_t *tag, sym_t *tdef)
|
||||
{
|
||||
|
||||
/*
|
||||
* 0 is no longer used.
|
||||
*/
|
||||
if (tag->s_name != unnamed) {
|
||||
outint(1);
|
||||
outname(tag->s_name);
|
||||
|
@ -194,7 +197,12 @@ outtt(tag, tdef)
|
|||
outint(2);
|
||||
outname(tdef->s_name);
|
||||
} else {
|
||||
outint(0);
|
||||
outint(3);
|
||||
outint(tag->s_dpos.p_line);
|
||||
outchar('.');
|
||||
outint(getfnid(tag->s_dpos.p_file));
|
||||
outchar('.');
|
||||
outint(tag->s_dpos.p_uniq);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,11 +214,9 @@ outtt(tag, tdef)
|
|||
* not here
|
||||
*/
|
||||
void
|
||||
outsym(sym, sc, def)
|
||||
sym_t *sym;
|
||||
scl_t sc;
|
||||
def_t def;
|
||||
outsym(sym_t *sym, scl_t sc, def_t def)
|
||||
{
|
||||
|
||||
/*
|
||||
* Static function declarations must also be written to the output
|
||||
* file. Compatibility of function declarations (for both static
|
||||
|
@ -266,6 +272,12 @@ outsym(sym, sc, def)
|
|||
/* name of the symbol */
|
||||
outname(sym->s_name);
|
||||
|
||||
/* renamed name of symbol, if necessary */
|
||||
if (sym->s_rename) {
|
||||
outchar('r');
|
||||
outname(sym->s_rename);
|
||||
}
|
||||
|
||||
/* type of the symbol */
|
||||
outtype(sym->s_type);
|
||||
}
|
||||
|
@ -277,10 +289,7 @@ outsym(sym, sc, def)
|
|||
* they are called with proper argument types
|
||||
*/
|
||||
void
|
||||
outfdef(fsym, posp, rval, osdef, args)
|
||||
sym_t *fsym, *args;
|
||||
pos_t *posp;
|
||||
int rval, osdef;
|
||||
outfdef(sym_t *fsym, pos_t *posp, int rval, int osdef, sym_t *args)
|
||||
{
|
||||
int narg;
|
||||
sym_t *arg;
|
||||
|
@ -352,6 +361,12 @@ outfdef(fsym, posp, rval, osdef, args)
|
|||
/* name of function */
|
||||
outname(fsym->s_name);
|
||||
|
||||
/* renamed name of function, if necessary */
|
||||
if (fsym->s_rename) {
|
||||
outchar('r');
|
||||
outname(fsym->s_rename);
|
||||
}
|
||||
|
||||
/* argument types and return value */
|
||||
if (osdef) {
|
||||
narg = 0;
|
||||
|
@ -376,13 +391,11 @@ outfdef(fsym, posp, rval, osdef, args)
|
|||
* (casted to void)
|
||||
*/
|
||||
void
|
||||
outcall(tn, rvused, rvdisc)
|
||||
tnode_t *tn;
|
||||
int rvused, rvdisc;
|
||||
outcall(tnode_t *tn, int rvused, int rvdisc)
|
||||
{
|
||||
tnode_t *args, *arg;
|
||||
int narg, n, i;
|
||||
quad_t q;
|
||||
int64_t q;
|
||||
tspec_t t;
|
||||
|
||||
/* reset buffer */
|
||||
|
@ -410,7 +423,8 @@ outcall(tn, rvused, rvdisc)
|
|||
/* informations about arguments */
|
||||
for (n = 1; n <= narg; n++) {
|
||||
/* the last argument is the top one in the tree */
|
||||
for (i = narg, arg = args; i > n; i--, arg = arg->tn_right) ;
|
||||
for (i = narg, arg = args; i > n; i--, arg = arg->tn_right)
|
||||
continue;
|
||||
arg = arg->tn_left;
|
||||
if (arg->tn_op == CON) {
|
||||
if (isityp(t = arg->tn_type->t_tspec)) {
|
||||
|
@ -451,7 +465,8 @@ outcall(tn, rvused, rvdisc)
|
|||
outint(narg);
|
||||
for (n = 1; n <= narg; n++) {
|
||||
/* the last argument is the top one in the tree */
|
||||
for (i = narg, arg = args; i > n; i--, arg = arg->tn_right) ;
|
||||
for (i = narg, arg = args; i > n; i--, arg = arg->tn_right)
|
||||
continue;
|
||||
outtype(arg->tn_left->tn_type);
|
||||
}
|
||||
/* expected type of return value */
|
||||
|
@ -463,8 +478,7 @@ outcall(tn, rvused, rvdisc)
|
|||
* writes them, enclosed in "" and qouted if necessary, to the output buffer
|
||||
*/
|
||||
static void
|
||||
outfstrg(strg)
|
||||
strg_t *strg;
|
||||
outfstrg(strg_t *strg)
|
||||
{
|
||||
int c, oc, first;
|
||||
u_char *cp;
|
||||
|
@ -563,8 +577,7 @@ outfstrg(strg)
|
|||
* writes a record if sym was used
|
||||
*/
|
||||
void
|
||||
outusg(sym)
|
||||
sym_t *sym;
|
||||
outusg(sym_t *sym)
|
||||
{
|
||||
/* reset buffer */
|
||||
outclr();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: externs1.h,v 1.7 1995/10/02 17:31:39 jpo Exp $ */
|
||||
/* $NetBSD: externs1.h,v 1.13 2002/01/18 21:01:39 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -42,16 +42,16 @@ extern int eflag;
|
|||
extern int Fflag;
|
||||
extern int gflag;
|
||||
extern int hflag;
|
||||
extern int pflag;
|
||||
extern int rflag;
|
||||
extern int sflag;
|
||||
extern int tflag;
|
||||
extern int uflag;
|
||||
extern int vflag;
|
||||
extern int yflag;
|
||||
extern int wflag;
|
||||
extern int zflag;
|
||||
|
||||
extern void norecover __P((void));
|
||||
extern void norecover(void);
|
||||
|
||||
/*
|
||||
* cgram.y
|
||||
|
@ -60,8 +60,8 @@ extern int blklev;
|
|||
extern int mblklev;
|
||||
extern int yydebug;
|
||||
|
||||
extern int yyerror __P((char *));
|
||||
extern int yyparse __P((void));
|
||||
extern int yyerror(char *);
|
||||
extern int yyparse(void);
|
||||
|
||||
/*
|
||||
* scan.l
|
||||
|
@ -70,41 +70,41 @@ extern pos_t curr_pos;
|
|||
extern pos_t csrc_pos;
|
||||
extern symt_t symtyp;
|
||||
extern FILE *yyin;
|
||||
extern u_quad_t qbmasks[], qlmasks[], qumasks[];
|
||||
extern uint64_t qbmasks[], qlmasks[], qumasks[];
|
||||
|
||||
extern void initscan __P((void));
|
||||
extern int sign __P((quad_t, tspec_t, int));
|
||||
extern int msb __P((quad_t, tspec_t, int));
|
||||
extern quad_t xsign __P((quad_t, tspec_t, int));
|
||||
extern void clrwflgs __P((void));
|
||||
extern sym_t *getsym __P((sbuf_t *));
|
||||
extern void cleanup __P((void));
|
||||
extern sym_t *pushdown __P((sym_t *));
|
||||
extern void rmsym __P((sym_t *));
|
||||
extern void rmsyms __P((sym_t *));
|
||||
extern void inssym __P((int, sym_t *));
|
||||
extern void freeyyv __P((void *, int));
|
||||
extern int yylex __P((void));
|
||||
extern void initscan(void);
|
||||
extern int sign(int64_t, tspec_t, int);
|
||||
extern int msb(int64_t, tspec_t, int);
|
||||
extern int64_t xsign(int64_t, tspec_t, int);
|
||||
extern void clrwflgs(void);
|
||||
extern sym_t *getsym(sbuf_t *);
|
||||
extern void cleanup(void);
|
||||
extern sym_t *pushdown(sym_t *);
|
||||
extern void rmsym(sym_t *);
|
||||
extern void rmsyms(sym_t *);
|
||||
extern void inssym(int, sym_t *);
|
||||
extern void freeyyv(void *, int);
|
||||
extern int yylex(void);
|
||||
|
||||
/*
|
||||
* mem1.c
|
||||
*/
|
||||
extern const char *fnalloc __P((const char *));
|
||||
extern const char *fnnalloc __P((const char *, size_t));
|
||||
extern int getfnid __P((const char *));
|
||||
extern const char *fnalloc(const char *);
|
||||
extern const char *fnnalloc(const char *, size_t);
|
||||
extern int getfnid(const char *);
|
||||
|
||||
extern void initmem __P((void));
|
||||
extern void initmem(void);
|
||||
|
||||
extern void *getblk __P((size_t));
|
||||
extern void *getlblk __P((int, size_t));
|
||||
extern void freeblk __P((void));
|
||||
extern void freelblk __P((int));
|
||||
extern void *getblk(size_t);
|
||||
extern void *getlblk(int, size_t);
|
||||
extern void freeblk(void);
|
||||
extern void freelblk(int);
|
||||
|
||||
extern void *tgetblk __P((size_t));
|
||||
extern tnode_t *getnode __P((void));
|
||||
extern void tfreeblk __P((void));
|
||||
extern struct mbl *tsave __P((void));
|
||||
extern void trestor __P((struct mbl *));
|
||||
extern void *tgetblk(size_t);
|
||||
extern tnode_t *getnode(void);
|
||||
extern void tfreeblk(void);
|
||||
extern struct mbl *tsave(void);
|
||||
extern void trestor(struct mbl *);
|
||||
|
||||
/*
|
||||
* err.c
|
||||
|
@ -113,11 +113,13 @@ extern int nerr;
|
|||
extern int sytxerr;
|
||||
extern const char *msgs[];
|
||||
|
||||
extern void error __P((int, ...));
|
||||
extern void warning __P((int, ...));
|
||||
extern void message __P((int, ...));
|
||||
extern int gnuism __P((int, ...));
|
||||
extern void lerror __P((const char *, ...));
|
||||
extern void msglist(void);
|
||||
extern void error(int, ...);
|
||||
extern void warning(int, ...);
|
||||
extern void message(int, ...);
|
||||
extern int gnuism(int, ...);
|
||||
extern void lerror(const char *, ...)
|
||||
__attribute__((__noreturn__,__format__(__printf__, 1, 2)));
|
||||
|
||||
/*
|
||||
* decl.c
|
||||
|
@ -126,82 +128,82 @@ extern dinfo_t *dcs;
|
|||
extern const char *unnamed;
|
||||
extern int enumval;
|
||||
|
||||
extern void initdecl __P((void));
|
||||
extern type_t *gettyp __P((tspec_t));
|
||||
extern type_t *duptyp __P((const type_t *));
|
||||
extern type_t *tduptyp __P((const type_t *));
|
||||
extern int incompl __P((type_t *));
|
||||
extern void setcompl __P((type_t *, int));
|
||||
extern void addscl __P((scl_t));
|
||||
extern void addtype __P((type_t *));
|
||||
extern void addqual __P((tqual_t));
|
||||
extern void pushdecl __P((scl_t));
|
||||
extern void popdecl __P((void));
|
||||
extern void setasm __P((void));
|
||||
extern void clrtyp __P((void));
|
||||
extern void deftyp __P((void));
|
||||
extern int length __P((type_t *, const char *));
|
||||
extern int getbound __P((type_t *));
|
||||
extern sym_t *lnklst __P((sym_t *, sym_t *));
|
||||
extern void chktyp __P((sym_t *));
|
||||
extern sym_t *decl1str __P((sym_t *));
|
||||
extern sym_t *bitfield __P((sym_t *, int));
|
||||
extern pqinf_t *mergepq __P((pqinf_t *, pqinf_t *));
|
||||
extern sym_t *addptr __P((sym_t *, pqinf_t *));
|
||||
extern sym_t *addarray __P((sym_t *, int, int));
|
||||
extern sym_t *addfunc __P((sym_t *, sym_t *));
|
||||
extern void chkfdef __P((sym_t *, int));
|
||||
extern sym_t *dname __P((sym_t *));
|
||||
extern sym_t *iname __P((sym_t *));
|
||||
extern type_t *mktag __P((sym_t *, tspec_t, int, int));
|
||||
extern const char *scltoa __P((scl_t));
|
||||
extern type_t *compltag __P((type_t *, sym_t *));
|
||||
extern sym_t *ename __P((sym_t *, int, int));
|
||||
extern void decl1ext __P((sym_t *, int));
|
||||
extern void cpuinfo __P((sym_t *, sym_t *));
|
||||
extern int isredec __P((sym_t *, int *));
|
||||
extern int eqtype __P((type_t *, type_t *, int, int, int *));
|
||||
extern void compltyp __P((sym_t *, sym_t *));
|
||||
extern sym_t *decl1arg __P((sym_t *, int));
|
||||
extern void cluparg __P((void));
|
||||
extern void decl1loc __P((sym_t *, int));
|
||||
extern sym_t *aname __P((void));
|
||||
extern void globclup __P((void));
|
||||
extern sym_t *decl1abs __P((sym_t *));
|
||||
extern void chksz __P((sym_t *));
|
||||
extern void setsflg __P((sym_t *));
|
||||
extern void setuflg __P((sym_t *, int, int));
|
||||
extern void chkusage __P((dinfo_t *));
|
||||
extern void chkusg1 __P((int, sym_t *));
|
||||
extern void chkglsyms __P((void));
|
||||
extern void prevdecl __P((int, sym_t *));
|
||||
extern void initdecl(void);
|
||||
extern type_t *gettyp(tspec_t);
|
||||
extern type_t *duptyp(const type_t *);
|
||||
extern type_t *tduptyp(const type_t *);
|
||||
extern int incompl(type_t *);
|
||||
extern void setcompl(type_t *, int);
|
||||
extern void addscl(scl_t);
|
||||
extern void addtype(type_t *);
|
||||
extern void addqual(tqual_t);
|
||||
extern void pushdecl(scl_t);
|
||||
extern void popdecl(void);
|
||||
extern void setasm(void);
|
||||
extern void clrtyp(void);
|
||||
extern void deftyp(void);
|
||||
extern int length(type_t *, const char *);
|
||||
extern int getbound(type_t *);
|
||||
extern sym_t *lnklst(sym_t *, sym_t *);
|
||||
extern void chktyp(sym_t *);
|
||||
extern sym_t *decl1str(sym_t *);
|
||||
extern sym_t *bitfield(sym_t *, int);
|
||||
extern pqinf_t *mergepq(pqinf_t *, pqinf_t *);
|
||||
extern sym_t *addptr(sym_t *, pqinf_t *);
|
||||
extern sym_t *addarray(sym_t *, int, int);
|
||||
extern sym_t *addfunc(sym_t *, sym_t *);
|
||||
extern void chkfdef(sym_t *, int);
|
||||
extern sym_t *dname(sym_t *);
|
||||
extern sym_t *iname(sym_t *);
|
||||
extern type_t *mktag(sym_t *, tspec_t, int, int);
|
||||
extern const char *scltoa(scl_t);
|
||||
extern type_t *compltag(type_t *, sym_t *);
|
||||
extern sym_t *ename(sym_t *, int, int);
|
||||
extern void decl1ext(sym_t *, int);
|
||||
extern void cpuinfo(sym_t *, sym_t *);
|
||||
extern int isredec(sym_t *, int *);
|
||||
extern int eqtype(type_t *, type_t *, int, int, int *);
|
||||
extern void compltyp(sym_t *, sym_t *);
|
||||
extern sym_t *decl1arg(sym_t *, int);
|
||||
extern void cluparg(void);
|
||||
extern void decl1loc(sym_t *, int);
|
||||
extern sym_t *aname(void);
|
||||
extern void globclup(void);
|
||||
extern sym_t *decl1abs(sym_t *);
|
||||
extern void chksz(sym_t *);
|
||||
extern void setsflg(sym_t *);
|
||||
extern void setuflg(sym_t *, int, int);
|
||||
extern void chkusage(dinfo_t *);
|
||||
extern void chkusg1(int, sym_t *);
|
||||
extern void chkglsyms(void);
|
||||
extern void prevdecl(int, sym_t *);
|
||||
|
||||
/*
|
||||
* tree.c
|
||||
*/
|
||||
extern void initmtab __P((void));
|
||||
extern type_t *incref __P((type_t *, tspec_t));
|
||||
extern type_t *tincref __P((type_t *, tspec_t));
|
||||
extern tnode_t *getcnode __P((type_t *, val_t *));
|
||||
extern tnode_t *getnnode __P((sym_t *, int));
|
||||
extern tnode_t *getsnode __P((strg_t *));
|
||||
extern sym_t *strmemb __P((tnode_t *, op_t, sym_t *));
|
||||
extern tnode_t *build __P((op_t, tnode_t *, tnode_t *));
|
||||
extern tnode_t *cconv __P((tnode_t *));
|
||||
extern int typeok __P((op_t, int, tnode_t *, tnode_t *));
|
||||
extern tnode_t *promote __P((op_t, int, tnode_t *));
|
||||
extern tnode_t *convert __P((op_t, int, type_t *, tnode_t *));
|
||||
extern void cvtcon __P((op_t, int, type_t *, val_t *, val_t *));
|
||||
extern const char *tyname __P((type_t *));
|
||||
extern tnode_t *bldszof __P((type_t *));
|
||||
extern tnode_t *cast __P((tnode_t *, type_t *));
|
||||
extern tnode_t *funcarg __P((tnode_t *, tnode_t *));
|
||||
extern tnode_t *funccall __P((tnode_t *, tnode_t *));
|
||||
extern val_t *constant __P((tnode_t *));
|
||||
extern void expr __P((tnode_t *, int, int));
|
||||
extern void chkmisc __P((tnode_t *, int, int, int, int, int, int));
|
||||
extern int conaddr __P((tnode_t *, sym_t **, ptrdiff_t *));
|
||||
extern strg_t *catstrg __P((strg_t *, strg_t *));
|
||||
extern void initmtab(void);
|
||||
extern type_t *incref(type_t *, tspec_t);
|
||||
extern type_t *tincref(type_t *, tspec_t);
|
||||
extern tnode_t *getcnode(type_t *, val_t *);
|
||||
extern tnode_t *getnnode(sym_t *, int);
|
||||
extern tnode_t *getsnode(strg_t *);
|
||||
extern sym_t *strmemb(tnode_t *, op_t, sym_t *);
|
||||
extern tnode_t *build(op_t, tnode_t *, tnode_t *);
|
||||
extern tnode_t *cconv(tnode_t *);
|
||||
extern int typeok(op_t, int, tnode_t *, tnode_t *);
|
||||
extern tnode_t *promote(op_t, int, tnode_t *);
|
||||
extern tnode_t *convert(op_t, int, type_t *, tnode_t *);
|
||||
extern void cvtcon(op_t, int, type_t *, val_t *, val_t *);
|
||||
extern const char *tyname(type_t *);
|
||||
extern tnode_t *bldszof(type_t *);
|
||||
extern tnode_t *cast(tnode_t *, type_t *);
|
||||
extern tnode_t *funcarg(tnode_t *, tnode_t *);
|
||||
extern tnode_t *funccall(tnode_t *, tnode_t *);
|
||||
extern val_t *constant(tnode_t *);
|
||||
extern void expr(tnode_t *, int, int);
|
||||
extern void chkmisc(tnode_t *, int, int, int, int, int, int);
|
||||
extern int conaddr(tnode_t *, sym_t **, ptrdiff_t *);
|
||||
extern strg_t *catstrg(strg_t *, strg_t *);
|
||||
|
||||
/*
|
||||
* func.c
|
||||
|
@ -221,42 +223,44 @@ extern pos_t scflpos;
|
|||
extern int ccflg;
|
||||
extern int llibflg;
|
||||
extern int nowarn;
|
||||
extern int bitfieldtype_ok;
|
||||
extern int plibflg;
|
||||
extern int quadflg;
|
||||
|
||||
extern void pushctrl __P((int));
|
||||
extern void popctrl __P((int));
|
||||
extern void chkreach __P((void));
|
||||
extern void funcdef __P((sym_t *));
|
||||
extern void funcend __P((void));
|
||||
extern void label __P((int, sym_t *, tnode_t *));
|
||||
extern void if1 __P((tnode_t *));
|
||||
extern void if2 __P((void));
|
||||
extern void if3 __P((int));
|
||||
extern void switch1 __P((tnode_t *));
|
||||
extern void switch2 __P((void));
|
||||
extern void while1 __P((tnode_t *));
|
||||
extern void while2 __P((void));
|
||||
extern void do1 __P((void));
|
||||
extern void do2 __P((tnode_t *));
|
||||
extern void for1 __P((tnode_t *, tnode_t *, tnode_t *));
|
||||
extern void for2 __P((void));
|
||||
extern void dogoto __P((sym_t *));
|
||||
extern void docont __P((void));
|
||||
extern void dobreak __P((void));
|
||||
extern void doreturn __P((tnode_t *));
|
||||
extern void glclup __P((int));
|
||||
extern void argsused __P((int));
|
||||
extern void constcond __P((int));
|
||||
extern void fallthru __P((int));
|
||||
extern void notreach __P((int));
|
||||
extern void lintlib __P((int));
|
||||
extern void linted __P((int));
|
||||
extern void varargs __P((int));
|
||||
extern void printflike __P((int));
|
||||
extern void scanflike __P((int));
|
||||
extern void protolib __P((int));
|
||||
extern void longlong __P((int));
|
||||
extern void pushctrl(int);
|
||||
extern void popctrl(int);
|
||||
extern void chkreach(void);
|
||||
extern void funcdef(sym_t *);
|
||||
extern void funcend(void);
|
||||
extern void label(int, sym_t *, tnode_t *);
|
||||
extern void if1(tnode_t *);
|
||||
extern void if2(void);
|
||||
extern void if3(int);
|
||||
extern void switch1(tnode_t *);
|
||||
extern void switch2(void);
|
||||
extern void while1(tnode_t *);
|
||||
extern void while2(void);
|
||||
extern void do1(void);
|
||||
extern void do2(tnode_t *);
|
||||
extern void for1(tnode_t *, tnode_t *, tnode_t *);
|
||||
extern void for2(void);
|
||||
extern void dogoto(sym_t *);
|
||||
extern void docont(void);
|
||||
extern void dobreak(void);
|
||||
extern void doreturn(tnode_t *);
|
||||
extern void glclup(int);
|
||||
extern void argsused(int);
|
||||
extern void constcond(int);
|
||||
extern void fallthru(int);
|
||||
extern void notreach(int);
|
||||
extern void lintlib(int);
|
||||
extern void linted(int);
|
||||
extern void varargs(int);
|
||||
extern void printflike(int);
|
||||
extern void scanflike(int);
|
||||
extern void protolib(int);
|
||||
extern void longlong(int);
|
||||
extern void bitfieldtype(int);
|
||||
|
||||
/*
|
||||
* init.c
|
||||
|
@ -265,17 +269,17 @@ extern int initerr;
|
|||
extern sym_t *initsym;
|
||||
extern int startinit;
|
||||
|
||||
extern void prepinit __P((void));
|
||||
extern void initrbr __P((void));
|
||||
extern void initlbr __P((void));
|
||||
extern void mkinit __P((tnode_t *));
|
||||
extern void prepinit(void);
|
||||
extern void initrbr(void);
|
||||
extern void initlbr(void);
|
||||
extern void mkinit(tnode_t *);
|
||||
|
||||
/*
|
||||
* emit.c
|
||||
*/
|
||||
extern void outtype __P((type_t *));
|
||||
extern const char *ttos __P((type_t *));
|
||||
extern void outsym __P((sym_t *, scl_t, def_t));
|
||||
extern void outfdef __P((sym_t *, pos_t *, int, int, sym_t *));
|
||||
extern void outcall __P((tnode_t *, int, int));
|
||||
extern void outusg __P((sym_t *));
|
||||
extern void outtype(type_t *);
|
||||
extern const char *ttos(type_t *);
|
||||
extern void outsym(sym_t *, scl_t, def_t);
|
||||
extern void outfdef(sym_t *, pos_t *, int, int, sym_t *);
|
||||
extern void outcall(tnode_t *, int, int);
|
||||
extern void outusg(sym_t *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $ */
|
||||
/* $NetBSD: init.c,v 1.9 2001/09/18 18:15:54 wiz Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -31,8 +31,9 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $";
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: init.c,v 1.9 2001/09/18 18:15:54 wiz Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -40,7 +41,7 @@ static char rcsid[] = "$NetBSD: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $";
|
|||
#include "lint1.h"
|
||||
|
||||
/*
|
||||
* initerr is set as soon as a fatal error occured in an initialisation.
|
||||
* initerr is set as soon as a fatal error occurred in an initialisation.
|
||||
* The effect is that the rest of the initialisation is ignored (parsed
|
||||
* by yacc, expression trees built, but no initialisation takes place).
|
||||
*/
|
||||
|
@ -53,12 +54,12 @@ sym_t *initsym;
|
|||
istk_t *initstk;
|
||||
|
||||
|
||||
static void popi2 __P((void));
|
||||
static void popinit __P((int));
|
||||
static void pushinit __P((void));
|
||||
static void testinit __P((void));
|
||||
static void nextinit __P((int));
|
||||
static int strginit __P((tnode_t *));
|
||||
static void popi2(void);
|
||||
static void popinit(int);
|
||||
static void pushinit(void);
|
||||
static void testinit(void);
|
||||
static void nextinit(int);
|
||||
static int strginit(tnode_t *);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -66,7 +67,7 @@ static int strginit __P((tnode_t *));
|
|||
* which is to be initialized on it.
|
||||
*/
|
||||
void
|
||||
prepinit()
|
||||
prepinit(void)
|
||||
{
|
||||
istk_t *istk;
|
||||
|
||||
|
@ -93,7 +94,7 @@ prepinit()
|
|||
}
|
||||
|
||||
static void
|
||||
popi2()
|
||||
popi2(void)
|
||||
{
|
||||
istk_t *istk;
|
||||
sym_t *m;
|
||||
|
@ -124,9 +125,9 @@ popi2()
|
|||
}
|
||||
|
||||
static void
|
||||
popinit(brace)
|
||||
int brace;
|
||||
popinit(int brace)
|
||||
{
|
||||
|
||||
if (brace) {
|
||||
/*
|
||||
* Take all entries, including the first which requires
|
||||
|
@ -150,7 +151,7 @@ popinit(brace)
|
|||
}
|
||||
|
||||
static void
|
||||
pushinit()
|
||||
pushinit(void)
|
||||
{
|
||||
istk_t *istk;
|
||||
int cnt;
|
||||
|
@ -235,7 +236,7 @@ pushinit()
|
|||
}
|
||||
|
||||
static void
|
||||
testinit()
|
||||
testinit(void)
|
||||
{
|
||||
istk_t *istk;
|
||||
|
||||
|
@ -266,9 +267,9 @@ testinit()
|
|||
}
|
||||
|
||||
static void
|
||||
nextinit(brace)
|
||||
int brace;
|
||||
nextinit(int brace)
|
||||
{
|
||||
|
||||
if (!brace) {
|
||||
if (initstk->i_type == NULL &&
|
||||
!issclt(initstk->i_subt->t_tspec)) {
|
||||
|
@ -303,8 +304,9 @@ nextinit(brace)
|
|||
}
|
||||
|
||||
void
|
||||
initlbr()
|
||||
initlbr(void)
|
||||
{
|
||||
|
||||
if (initerr)
|
||||
return;
|
||||
|
||||
|
@ -325,8 +327,9 @@ initlbr()
|
|||
}
|
||||
|
||||
void
|
||||
initrbr()
|
||||
initrbr(void)
|
||||
{
|
||||
|
||||
if (initerr)
|
||||
return;
|
||||
|
||||
|
@ -334,8 +337,7 @@ initrbr()
|
|||
}
|
||||
|
||||
void
|
||||
mkinit(tn)
|
||||
tnode_t *tn;
|
||||
mkinit(tnode_t *tn)
|
||||
{
|
||||
ptrdiff_t offs;
|
||||
sym_t *sym;
|
||||
|
@ -351,7 +353,7 @@ mkinit(tn)
|
|||
|
||||
/*
|
||||
* Do not test for automatic aggregat initialisation. If the
|
||||
* initalizer starts with a brace we have the warning already.
|
||||
* initializer starts with a brace we have the warning already.
|
||||
* If not, an error will be printed that the initializer must
|
||||
* be enclosed by braces.
|
||||
*/
|
||||
|
@ -412,7 +414,7 @@ mkinit(tn)
|
|||
tmem = tsave();
|
||||
expr(tn, 1, 0);
|
||||
trestor(tmem);
|
||||
|
||||
|
||||
if (isityp(lt) && ln->tn_type->t_isfield && !isityp(rt)) {
|
||||
/*
|
||||
* Bit-fields can be initialized in trad. C only by integer
|
||||
|
@ -446,8 +448,7 @@ mkinit(tn)
|
|||
|
||||
|
||||
static int
|
||||
strginit(tn)
|
||||
tnode_t *tn;
|
||||
strginit(tnode_t *tn)
|
||||
{
|
||||
tspec_t t;
|
||||
istk_t *istk;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: lint1.h,v 1.6 1995/10/02 17:31:41 jpo Exp $ */
|
||||
/* $NetBSD: lint1.h,v 1.12 2002/01/31 19:33:27 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
|
@ -34,14 +35,29 @@
|
|||
#include "lint.h"
|
||||
#include "op.h"
|
||||
|
||||
/* XXX - works for most systems, but the whole ALIGN thing needs to go away */
|
||||
#ifndef ALIGN
|
||||
#define ALIGN(x) (((x) + 7) & ~7)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Describes the position of a declaration or anything else.
|
||||
*/
|
||||
typedef struct {
|
||||
int p_line;
|
||||
const char *p_file;
|
||||
int p_uniq; /* uniquifier */
|
||||
} pos_t;
|
||||
|
||||
/* Copies curr_pos, keeping things unique. */
|
||||
#define UNIQUE_CURR_POS(pos) \
|
||||
do { \
|
||||
STRUCT_ASSIGN((pos), curr_pos); \
|
||||
curr_pos.p_uniq++; \
|
||||
if (curr_pos.p_file == csrc_pos.p_file) \
|
||||
csrc_pos.p_uniq++; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Strings cannot be referenced to simply by a pointer to its first
|
||||
* char. This is because strings can contain NUL characters other than the
|
||||
|
@ -76,7 +92,7 @@ typedef struct {
|
|||
int v_ansiu; /* set if an integer constant is
|
||||
unsigned in ANSI C */
|
||||
union {
|
||||
quad_t _v_quad; /* integers */
|
||||
int64_t _v_quad; /* integers */
|
||||
ldbl_t _v_ldbl; /* floats */
|
||||
} v_u;
|
||||
} val_t;
|
||||
|
@ -132,11 +148,11 @@ typedef struct type {
|
|||
str_t *_t_str; /* struct/union tag */
|
||||
enum_t *_t_enum; /* enum tag */
|
||||
struct sym *_t_args; /* arguments (if t_proto) */
|
||||
struct {
|
||||
u_int _t_flen : 8; /* length of bit-field */
|
||||
u_int _t_foffs : 24; /* offset of bit-field */
|
||||
} _t_u;
|
||||
} t_u;
|
||||
struct {
|
||||
u_int _t_flen : 8; /* length of bit-field */
|
||||
u_int _t_foffs : 24; /* offset of bit-field */
|
||||
} t_b;
|
||||
struct type *t_subt; /* element type (arrays), return value
|
||||
(functions), or type pointer points to */
|
||||
} type_t;
|
||||
|
@ -146,8 +162,8 @@ typedef struct type {
|
|||
#define t_field t_u._t_field
|
||||
#define t_enum t_u._t_enum
|
||||
#define t_args t_u._t_args
|
||||
#define t_flen t_u._t_u._t_flen
|
||||
#define t_foffs t_u._t_u._t_foffs
|
||||
#define t_flen t_b._t_flen
|
||||
#define t_foffs t_b._t_foffs
|
||||
|
||||
/*
|
||||
* types of symbols
|
||||
|
@ -187,6 +203,7 @@ typedef enum {
|
|||
*/
|
||||
typedef struct sym {
|
||||
const char *s_name; /* name */
|
||||
const char *s_rename; /* renamed symbol's given name */
|
||||
pos_t s_dpos; /* position of last (prototype)definition,
|
||||
prototypedeclaration, no-prototype-def.,
|
||||
tentative definition or declaration,
|
||||
|
@ -378,3 +395,20 @@ typedef struct cstk {
|
|||
} cstk_t;
|
||||
|
||||
#include "externs1.h"
|
||||
|
||||
#define ERR_SETSIZE 1024
|
||||
#define __NERRBITS (sizeof(unsigned int))
|
||||
|
||||
typedef struct err_set {
|
||||
unsigned int errs_bits[(ERR_SETSIZE + __NERRBITS-1) / __NERRBITS];
|
||||
} err_set;
|
||||
|
||||
#define ERR_SET(n, p) \
|
||||
((p)->errs_bits[(n)/__NERRBITS] |= (1 << ((n) % __NERRBITS)))
|
||||
#define ERR_CLR(n, p) \
|
||||
((p)->errs_bits[(n)/__NERRBITS] &= ~(1 << ((n) % __NERRBITS)))
|
||||
#define ERR_ISSET(n, p) \
|
||||
((p)->errs_bits[(n)/__NERRBITS] & (1 << ((n) % __NERRBITS)))
|
||||
#define ERR_ZERO(p) (void)memset((p), 0, sizeof(*(p)))
|
||||
|
||||
extern err_set msgset;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main1.c,v 1.3 1995/10/02 17:29:56 jpo Exp $ */
|
||||
/* $NetBSD: main1.c,v 1.11 2002/01/29 02:43:38 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -31,14 +31,18 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: main1.c,v 1.3 1995/10/02 17:29:56 jpo Exp $";
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: main1.c,v 1.11 2002/01/29 02:43:38 tv Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "lint1.h"
|
||||
|
||||
|
@ -49,7 +53,7 @@ int yflag;
|
|||
* Print warnings if an assignment of an integertype to another integertype
|
||||
* causes an implizit narrowing conversion. If aflag is 1, these warnings
|
||||
* are printed only if the source type is at least as wide as long. If aflag
|
||||
* is greather then 1, they are always printed.
|
||||
* is greater than 1, they are always printed.
|
||||
*/
|
||||
int aflag;
|
||||
|
||||
|
@ -71,6 +75,9 @@ int Fflag;
|
|||
/* Enable some extensions of gcc */
|
||||
int gflag;
|
||||
|
||||
/* Treat warnings as errors */
|
||||
int wflag;
|
||||
|
||||
/*
|
||||
* Apply a number of heuristic tests to attempt to intuit bugs, improve
|
||||
* style, and reduce waste.
|
||||
|
@ -104,16 +111,22 @@ int vflag = 1;
|
|||
/* Complain about structures which are never defined. */
|
||||
int zflag = 1;
|
||||
|
||||
static void usage __P((void));
|
||||
err_set msgset;
|
||||
|
||||
static void usage(void);
|
||||
|
||||
int main(int, char *[]);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
char *ptr;
|
||||
|
||||
while ((c = getopt(argc, argv, "abcdeghprstuvyzF")) != -1) {
|
||||
setprogname(argv[0]);
|
||||
|
||||
ERR_ZERO(&msgset);
|
||||
while ((c = getopt(argc, argv, "abcdeghmprstuvwyzFX:")) != -1) {
|
||||
switch (c) {
|
||||
case 'a': aflag++; break;
|
||||
case 'b': bflag = 1; break;
|
||||
|
@ -128,10 +141,35 @@ main(argc, argv)
|
|||
case 's': sflag = 1; break;
|
||||
case 't': tflag = 1; break;
|
||||
case 'u': uflag = 0; break;
|
||||
case 'w': wflag = 1; break;
|
||||
case 'v': vflag = 0; break;
|
||||
case 'y': yflag = 1; break;
|
||||
case 'z': zflag = 0; break;
|
||||
case '?': usage();
|
||||
|
||||
case 'm':
|
||||
msglist();
|
||||
return(0);
|
||||
|
||||
case 'X':
|
||||
for (ptr = strtok(optarg, ","); ptr;
|
||||
ptr = strtok(NULL, ",")) {
|
||||
char *eptr;
|
||||
long msg = strtol(ptr, &eptr, 0);
|
||||
if ((msg == LONG_MIN || msg == LONG_MAX) &&
|
||||
errno == ERANGE)
|
||||
err(1, "invalid error message id '%s'",
|
||||
ptr);
|
||||
if (*eptr || ptr == eptr || msg < 0 ||
|
||||
msg >= ERR_SETSIZE)
|
||||
errx(1, "invalid error message id '%s'",
|
||||
ptr);
|
||||
ERR_SET(msg, &msgset);
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
|
@ -168,14 +206,16 @@ main(argc, argv)
|
|||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, "usage: lint1 [-abcdeghprstuvyzF] src dest\n");
|
||||
(void)fprintf(stderr,
|
||||
"Usage: %s [-abcdeghmprstuvwyzF] [-X <id>[,<id>]... src dest\n",
|
||||
getprogname());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
norecover()
|
||||
norecover(void)
|
||||
{
|
||||
/* cannot recover from previous errors */
|
||||
error(224);
|
||||
|
|
94
usr.bin/xlint/lint1/makeman
Normal file
94
usr.bin/xlint/lint1/makeman
Normal file
|
@ -0,0 +1,94 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD$
|
||||
#
|
||||
# Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Christos Zoulas.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# This product includes software developed by the NetBSD
|
||||
# Foundation, Inc. and its contributors.
|
||||
# 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
cat << \__EOF
|
||||
.\" $NetBSD$
|
||||
.\"
|
||||
.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to The NetBSD Foundation
|
||||
.\" by Christos Zoulas.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the NetBSD
|
||||
.\" Foundation, Inc. and its contributors.
|
||||
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
.\" contributors may be used to endorse or promote products derived
|
||||
.\" from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.Dd July 5, 2000
|
||||
.Dt LINT 7
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm lint
|
||||
.Nd Lint error message list
|
||||
.Sh DESCRIPTION
|
||||
The following is a list of message id's and messages produced by
|
||||
.Xr lint 1 .
|
||||
It is intended to be used with
|
||||
.Fl X
|
||||
flag of
|
||||
.Xr lint 1 .
|
||||
.Pp
|
||||
.Bd -ragged -offset indent -compact
|
||||
.Bl -column "Id# Message"
|
||||
__EOF
|
||||
"$@" | sed -e 's/^/.It /' -e 's/\\/\\e/g' -e "s/'/\\'/"
|
||||
echo ".El"
|
||||
echo ".Ed"
|
|
@ -48,7 +48,7 @@ typedef struct {
|
|||
u_int m_tlansiu : 1; /* warning if left op. is unsign. in ANSI C */
|
||||
u_int m_transiu : 1; /* warning if right op. is unsign. in ANSI C */
|
||||
u_int m_tpconf : 1; /* test possible precedence confusion */
|
||||
u_int m_comp : 1; /* op. performs comparision */
|
||||
u_int m_comp : 1; /* op. performs comparison */
|
||||
u_int m_enumop : 1; /* valid operation on enums */
|
||||
u_int m_badeop : 1; /* dubious operation on enums */
|
||||
u_int m_eqwarn : 1; /* warning if on operand stems from == */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: chk.c,v 1.2 1995/07/03 21:24:42 cgd Exp $ */
|
||||
/* $NetBSD: chk.c,v 1.15 2002/01/21 19:49:52 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
|
@ -31,138 +32,44 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: chk.c,v 1.2 1995/07/03 21:24:42 cgd Exp $";
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: chk.c,v 1.15 2002/01/21 19:49:52 tv Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lint2.h"
|
||||
|
||||
/* various type information */
|
||||
ttab_t ttab[NTSPEC];
|
||||
|
||||
|
||||
static void chkund __P((hte_t *));
|
||||
static void chkdnu __P((hte_t *));
|
||||
static void chkdnud __P((hte_t *));
|
||||
static void chkmd __P((hte_t *));
|
||||
static void chkvtui __P((hte_t *, sym_t *, sym_t *));
|
||||
static void chkvtdi __P((hte_t *, sym_t *, sym_t *));
|
||||
static void chkfaui __P((hte_t *, sym_t *, sym_t *));
|
||||
static void chkau __P((hte_t *, int, sym_t *, sym_t *, pos_t *,
|
||||
fcall_t *, fcall_t *, type_t *, type_t *));
|
||||
static void chkrvu __P((hte_t *, sym_t *));
|
||||
static void chkadecl __P((hte_t *, sym_t *, sym_t *));
|
||||
static void printflike __P((hte_t *,fcall_t *, int,
|
||||
const char *, type_t **));
|
||||
static void scanflike __P((hte_t *, fcall_t *, int,
|
||||
const char *, type_t **));
|
||||
static void badfmt __P((hte_t *, fcall_t *));
|
||||
static void inconarg __P((hte_t *, fcall_t *, int));
|
||||
static void tofewarg __P((hte_t *, fcall_t *));
|
||||
static void tomanyarg __P((hte_t *, fcall_t *));
|
||||
static int eqtype __P((type_t *, type_t *, int, int, int, int *));
|
||||
static int eqargs __P((type_t *, type_t *, int *));
|
||||
static int mnoarg __P((type_t *, int *));
|
||||
|
||||
|
||||
void
|
||||
inittyp()
|
||||
{
|
||||
int i;
|
||||
static struct {
|
||||
tspec_t it_tspec;
|
||||
ttab_t it_ttab;
|
||||
} ittab[] = {
|
||||
{ SIGNED, { 0, 0,
|
||||
SIGNED, UNSIGN,
|
||||
0, 0, 0, 0, 0, "signed" } },
|
||||
{ UNSIGN, { 0, 0,
|
||||
SIGNED, UNSIGN,
|
||||
0, 0, 0, 0, 0, "unsigned" } },
|
||||
{ CHAR, { CHAR_BIT, CHAR_BIT,
|
||||
SCHAR, UCHAR,
|
||||
1, 0, 0, 1, 1, "char" } },
|
||||
{ SCHAR, { CHAR_BIT, CHAR_BIT,
|
||||
SCHAR, UCHAR,
|
||||
1, 0, 0, 1, 1, "signed char" } },
|
||||
{ UCHAR, { CHAR_BIT, CHAR_BIT,
|
||||
SCHAR, UCHAR,
|
||||
1, 1, 0, 1, 1, "unsigned char" } },
|
||||
{ SHORT, { sizeof (short) * CHAR_BIT, 2 * CHAR_BIT,
|
||||
SHORT, USHORT,
|
||||
1, 0, 0, 1, 1, "short" } },
|
||||
{ USHORT, { sizeof (u_short) * CHAR_BIT, 2 * CHAR_BIT,
|
||||
SHORT, USHORT,
|
||||
1, 1, 0, 1, 1, "unsigned short" } },
|
||||
{ INT, { sizeof (int) * CHAR_BIT, 3 * CHAR_BIT,
|
||||
INT, UINT,
|
||||
1, 0, 0, 1, 1, "int" } },
|
||||
{ UINT, { sizeof (u_int) * CHAR_BIT, 3 * CHAR_BIT,
|
||||
INT, UINT,
|
||||
1, 1, 0, 1, 1, "unsigned int" } },
|
||||
{ LONG, { sizeof (long) * CHAR_BIT, 4 * CHAR_BIT,
|
||||
LONG, ULONG,
|
||||
1, 0, 0, 1, 1, "long" } },
|
||||
{ ULONG, { sizeof (u_long) * CHAR_BIT, 4 * CHAR_BIT,
|
||||
LONG, ULONG,
|
||||
1, 1, 0, 1, 1, "unsigned long" } },
|
||||
{ QUAD, { sizeof (quad_t) * CHAR_BIT, 8 * CHAR_BIT,
|
||||
QUAD, UQUAD,
|
||||
1, 0, 0, 1, 1, "long long" } },
|
||||
{ UQUAD, { sizeof (u_quad_t) * CHAR_BIT, 8 * CHAR_BIT,
|
||||
QUAD, UQUAD,
|
||||
1, 1, 0, 1, 1, "unsigned long long" } },
|
||||
{ FLOAT, { sizeof (float) * CHAR_BIT, 4 * CHAR_BIT,
|
||||
FLOAT, FLOAT,
|
||||
0, 0, 1, 1, 1, "float" } },
|
||||
{ DOUBLE, { sizeof (double) * CHAR_BIT, 8 * CHAR_BIT,
|
||||
DOUBLE, DOUBLE,
|
||||
0, 0, 1, 1, 1, "double" } },
|
||||
{ LDOUBLE, { sizeof (ldbl_t) * CHAR_BIT, 10 * CHAR_BIT,
|
||||
LDOUBLE, LDOUBLE,
|
||||
0, 0, 1, 1, 1, "long double" } },
|
||||
{ VOID, { -1, -1,
|
||||
VOID, VOID,
|
||||
0, 0, 0, 0, 0, "void" } },
|
||||
{ STRUCT, { -1, -1,
|
||||
STRUCT, STRUCT,
|
||||
0, 0, 0, 0, 0, "struct" } },
|
||||
{ UNION, { -1, -1,
|
||||
UNION, UNION,
|
||||
0, 0, 0, 0, 0, "union" } },
|
||||
{ ENUM, { sizeof (int) * CHAR_BIT, 3 * CHAR_BIT,
|
||||
ENUM, ENUM,
|
||||
1, 0, 0, 1, 1, "enum" } },
|
||||
{ PTR, { sizeof (void *) * CHAR_BIT, 4 * CHAR_BIT,
|
||||
PTR, PTR,
|
||||
0, 1, 0, 0, 1, "pointer" } },
|
||||
{ ARRAY, { -1, -1,
|
||||
ARRAY, ARRAY,
|
||||
0, 0, 0, 0, 0, "array" } },
|
||||
{ FUNC, { -1, -1,
|
||||
FUNC, FUNC,
|
||||
0, 0, 0, 0, 0, "function" } },
|
||||
};
|
||||
|
||||
for (i = 0; i < sizeof (ittab) / sizeof (ittab[0]); i++)
|
||||
STRUCT_ASSIGN(ttab[ittab[i].it_tspec], ittab[i].it_ttab);
|
||||
if (!pflag) {
|
||||
for (i = 0; i < NTSPEC; i++)
|
||||
ttab[i].tt_psz = ttab[i].tt_sz;
|
||||
}
|
||||
}
|
||||
static void chkund(hte_t *);
|
||||
static void chkdnu(hte_t *);
|
||||
static void chkdnud(hte_t *);
|
||||
static void chkmd(hte_t *);
|
||||
static void chkvtui(hte_t *, sym_t *, sym_t *);
|
||||
static void chkvtdi(hte_t *, sym_t *, sym_t *);
|
||||
static void chkfaui(hte_t *, sym_t *, sym_t *);
|
||||
static void chkau(hte_t *, int, sym_t *, sym_t *, pos_t *,
|
||||
fcall_t *, fcall_t *, type_t *, type_t *);
|
||||
static void chkrvu(hte_t *, sym_t *);
|
||||
static void chkadecl(hte_t *, sym_t *, sym_t *);
|
||||
static void printflike(hte_t *,fcall_t *, int, const char *, type_t **);
|
||||
static void scanflike(hte_t *, fcall_t *, int, const char *, type_t **);
|
||||
static void badfmt(hte_t *, fcall_t *);
|
||||
static void inconarg(hte_t *, fcall_t *, int);
|
||||
static void tofewarg(hte_t *, fcall_t *);
|
||||
static void tomanyarg(hte_t *, fcall_t *);
|
||||
static int eqtype(type_t *, type_t *, int, int, int, int *);
|
||||
static int eqargs(type_t *, type_t *, int *);
|
||||
static int mnoarg(type_t *, int *);
|
||||
|
||||
|
||||
/*
|
||||
* If there is a symbol named "main", mark it as used.
|
||||
*/
|
||||
void
|
||||
mainused()
|
||||
mainused(void)
|
||||
{
|
||||
hte_t *hte;
|
||||
|
||||
|
@ -174,8 +81,7 @@ mainused()
|
|||
* Performs all tests for a single name
|
||||
*/
|
||||
void
|
||||
chkname(hte)
|
||||
hte_t *hte;
|
||||
chkname(hte_t *hte)
|
||||
{
|
||||
sym_t *sym, *def, *pdecl, *decl;
|
||||
|
||||
|
@ -220,8 +126,7 @@ chkname(hte)
|
|||
* Print a warning if the name has been used, but not defined.
|
||||
*/
|
||||
static void
|
||||
chkund(hte)
|
||||
hte_t *hte;
|
||||
chkund(hte_t *hte)
|
||||
{
|
||||
fcall_t *fcall;
|
||||
usym_t *usym;
|
||||
|
@ -242,8 +147,7 @@ chkund(hte)
|
|||
* Print a warning if the name has been defined, but never used.
|
||||
*/
|
||||
static void
|
||||
chkdnu(hte)
|
||||
hte_t *hte;
|
||||
chkdnu(hte_t *hte)
|
||||
{
|
||||
sym_t *sym;
|
||||
|
||||
|
@ -260,33 +164,33 @@ chkdnu(hte)
|
|||
}
|
||||
|
||||
/*
|
||||
* Print a warning if the name has been declared, but is not used
|
||||
* Print a warning if the variable has been declared, but is not used
|
||||
* or defined.
|
||||
*/
|
||||
static void
|
||||
chkdnud(hte)
|
||||
hte_t *hte;
|
||||
chkdnud(hte_t *hte)
|
||||
{
|
||||
sym_t *sym;
|
||||
|
||||
if (hte->h_syms == NULL || hte->h_used || hte->h_def)
|
||||
return;
|
||||
|
||||
if ((sym = hte->h_syms) != NULL) {
|
||||
if (sym->s_def != DECL)
|
||||
errx(1, "internal error: chkdnud() 1");
|
||||
/* %s declared( %s ), but never used or defined */
|
||||
msg(2, hte->h_name, mkpos(&sym->s_pos));
|
||||
}
|
||||
|
||||
sym = hte->h_syms;
|
||||
if (TP(sym->s_type)->t_tspec == FUNC)
|
||||
return;
|
||||
|
||||
if (sym->s_def != DECL)
|
||||
errx(1, "internal error: chkdnud() 1");
|
||||
/* %s declared( %s ), but never used or defined */
|
||||
msg(2, hte->h_name, mkpos(&sym->s_pos));
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a warning if there is more then one definition for
|
||||
* Print a warning if there is more than one definition for
|
||||
* this name.
|
||||
*/
|
||||
static void
|
||||
chkmd(hte)
|
||||
hte_t *hte;
|
||||
chkmd(hte_t *hte)
|
||||
{
|
||||
sym_t *sym, *def1;
|
||||
char *pos1;
|
||||
|
@ -323,9 +227,7 @@ chkmd(hte)
|
|||
* call as it's done for function arguments.
|
||||
*/
|
||||
static void
|
||||
chkvtui(hte, def, decl)
|
||||
hte_t *hte;
|
||||
sym_t *def, *decl;
|
||||
chkvtui(hte_t *hte, sym_t *def, sym_t *decl)
|
||||
{
|
||||
fcall_t *call;
|
||||
char *pos1;
|
||||
|
@ -386,9 +288,7 @@ chkvtui(hte, def, decl)
|
|||
* types of return values are tested.
|
||||
*/
|
||||
static void
|
||||
chkvtdi(hte, def, decl)
|
||||
hte_t *hte;
|
||||
sym_t *def, *decl;
|
||||
chkvtdi(hte_t *hte, sym_t *def, sym_t *decl)
|
||||
{
|
||||
sym_t *sym;
|
||||
type_t *tp1, *tp2;
|
||||
|
@ -427,12 +327,10 @@ chkvtdi(hte, def, decl)
|
|||
* of the same function.
|
||||
*/
|
||||
static void
|
||||
chkfaui(hte, def, decl)
|
||||
hte_t *hte;
|
||||
sym_t *def, *decl;
|
||||
chkfaui(hte_t *hte, sym_t *def, sym_t *decl)
|
||||
{
|
||||
type_t *tp1, *tp2, **ap1, **ap2;
|
||||
pos_t *pos1p;
|
||||
pos_t *pos1p = NULL;
|
||||
fcall_t *calls, *call, *call1;
|
||||
int n, as;
|
||||
char *pos1;
|
||||
|
@ -442,7 +340,7 @@ chkfaui(hte, def, decl)
|
|||
return;
|
||||
|
||||
/*
|
||||
* If we find a function definition, we use this for comparision,
|
||||
* If we find a function definition, we use this for comparison,
|
||||
* otherwise the first prototype we can find. If there is no
|
||||
* definition or prototype declaration, the first function call
|
||||
* is used.
|
||||
|
@ -537,13 +435,8 @@ chkfaui(hte, def, decl)
|
|||
*
|
||||
*/
|
||||
static void
|
||||
chkau(hte, n, def, decl, pos1p, call1, call, arg1, arg2)
|
||||
hte_t *hte;
|
||||
int n;
|
||||
sym_t *def, *decl;
|
||||
pos_t *pos1p;
|
||||
fcall_t *call1, *call;
|
||||
type_t *arg1, *arg2;
|
||||
chkau(hte_t *hte, int n, sym_t *def, sym_t *decl, pos_t *pos1p,
|
||||
fcall_t *call1, fcall_t *call, type_t *arg1, type_t *arg2)
|
||||
{
|
||||
/* LINTED (automatic hides external declaration: warn) */
|
||||
int promote, asgn, warn;
|
||||
|
@ -577,7 +470,7 @@ chkau(hte, n, def, decl, pos1p, call1, call, arg1, arg2)
|
|||
/*
|
||||
* Other lint implementations print warnings as soon as the type
|
||||
* of an argument does not match exactly the expected type. The
|
||||
* result are lots of warnings which are really not neccessary.
|
||||
* result are lots of warnings which are really not necessary.
|
||||
* We print a warning only if
|
||||
* (0) at least one type is not an interger type and types differ
|
||||
* (1) hflag is set and types differ
|
||||
|
@ -670,11 +563,16 @@ chkau(hte, n, def, decl, pos1p, call1, call, arg1, arg2)
|
|||
}
|
||||
}
|
||||
|
||||
} else if (t1 == PTR && isityp(t2) && psize(t1) == psize(t2)) {
|
||||
} else if (t1 == PTR && isityp(t2)) {
|
||||
for (ai = call->f_args; ai != NULL; ai = ai->a_nxt) {
|
||||
if (ai->a_num == n)
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Vendor implementations of lint (e.g. HP-UX, Digital UNIX)
|
||||
* don't care about the size of the integer argument,
|
||||
* only whether or not it is zero. We do the same.
|
||||
*/
|
||||
if (ai != NULL && ai->a_zero)
|
||||
return;
|
||||
}
|
||||
|
@ -690,17 +588,12 @@ chkau(hte, n, def, decl, pos1p, call1, call, arg1, arg2)
|
|||
* string fmt.
|
||||
*/
|
||||
static void
|
||||
printflike(hte, call, n, fmt, ap)
|
||||
hte_t *hte;
|
||||
fcall_t *call;
|
||||
int n;
|
||||
const char *fmt;
|
||||
type_t **ap;
|
||||
printflike(hte_t *hte, fcall_t *call, int n, const char *fmt, type_t **ap)
|
||||
{
|
||||
const char *fp;
|
||||
int fc;
|
||||
int fwidth, prec, left, sign, space, alt, zero;
|
||||
tspec_t sz, t1, t2;
|
||||
tspec_t sz, t1, t2 = NOTSPEC;
|
||||
type_t *tp;
|
||||
|
||||
fp = fmt;
|
||||
|
@ -920,18 +813,13 @@ printflike(hte, call, n, fmt, ap)
|
|||
* string fmt.
|
||||
*/
|
||||
static void
|
||||
scanflike(hte, call, n, fmt, ap)
|
||||
hte_t *hte;
|
||||
fcall_t *call;
|
||||
int n;
|
||||
const char *fmt;
|
||||
type_t **ap;
|
||||
scanflike(hte_t *hte, fcall_t *call, int n, const char *fmt, type_t **ap)
|
||||
{
|
||||
const char *fp;
|
||||
int fc;
|
||||
int noasgn, fwidth;
|
||||
tspec_t sz, t1, t2;
|
||||
type_t *tp;
|
||||
tspec_t sz, t1 = NOTSPEC, t2 = NOTSPEC;
|
||||
type_t *tp = NULL;
|
||||
|
||||
fp = fmt;
|
||||
fc = *fp++;
|
||||
|
@ -955,7 +843,7 @@ scanflike(hte, call, n, fmt, ap)
|
|||
noasgn = 1;
|
||||
fc = *fp++;
|
||||
}
|
||||
|
||||
|
||||
if (isdigit(fc)) {
|
||||
fwidth = 1;
|
||||
do { fc = *fp++; } while (isdigit(fc));
|
||||
|
@ -1116,38 +1004,33 @@ scanflike(hte, call, n, fmt, ap)
|
|||
}
|
||||
|
||||
static void
|
||||
badfmt(hte, call)
|
||||
hte_t *hte;
|
||||
fcall_t *call;
|
||||
badfmt(hte_t *hte, fcall_t *call)
|
||||
{
|
||||
|
||||
/* %s: malformed format string\t%s */
|
||||
msg(13, hte->h_name, mkpos(&call->f_pos));
|
||||
}
|
||||
|
||||
static void
|
||||
inconarg(hte, call, n)
|
||||
hte_t *hte;
|
||||
fcall_t *call;
|
||||
int n;
|
||||
inconarg(hte_t *hte, fcall_t *call, int n)
|
||||
{
|
||||
|
||||
/* %s, arg %d inconsistent with format\t%s(%d) */
|
||||
msg(14, hte->h_name, n, mkpos(&call->f_pos));
|
||||
}
|
||||
|
||||
static void
|
||||
tofewarg(hte, call)
|
||||
hte_t *hte;
|
||||
fcall_t *call;
|
||||
tofewarg(hte_t *hte, fcall_t *call)
|
||||
{
|
||||
|
||||
/* %s: too few args for format \t%s */
|
||||
msg(15, hte->h_name, mkpos(&call->f_pos));
|
||||
}
|
||||
|
||||
static void
|
||||
tomanyarg(hte, call)
|
||||
hte_t *hte;
|
||||
fcall_t *call;
|
||||
tomanyarg(hte_t *hte, fcall_t *call)
|
||||
{
|
||||
|
||||
/* %s: too many args for format \t%s */
|
||||
msg(16, hte->h_name, mkpos(&call->f_pos));
|
||||
}
|
||||
|
@ -1158,9 +1041,7 @@ tomanyarg(hte, call)
|
|||
* or return values which are always or sometimes ignored.
|
||||
*/
|
||||
static void
|
||||
chkrvu(hte, def)
|
||||
hte_t *hte;
|
||||
sym_t *def;
|
||||
chkrvu(hte_t *hte, sym_t *def)
|
||||
{
|
||||
fcall_t *call;
|
||||
int used, ignored;
|
||||
|
@ -1176,7 +1057,7 @@ chkrvu(hte, def)
|
|||
/* function has return value */
|
||||
used = ignored = 0;
|
||||
for (call = hte->h_calls; call != NULL; call = call->f_nxt) {
|
||||
used |= call->f_rused;
|
||||
used |= call->f_rused || call->f_rdisc;
|
||||
ignored |= !call->f_rused && !call->f_rdisc;
|
||||
}
|
||||
/*
|
||||
|
@ -1208,9 +1089,7 @@ chkrvu(hte, def)
|
|||
* Print warnings for inconsistent argument declarations.
|
||||
*/
|
||||
static void
|
||||
chkadecl(hte, def, decl)
|
||||
hte_t *hte;
|
||||
sym_t *def, *decl;
|
||||
chkadecl(hte_t *hte, sym_t *def, sym_t *decl)
|
||||
{
|
||||
/* LINTED (automatic hides external declaration: warn) */
|
||||
int osdef, eq, warn, n;
|
||||
|
@ -1280,8 +1159,8 @@ chkadecl(hte, def, decl)
|
|||
*
|
||||
* ignqual if set, ignore qualifiers of outhermost type; used for
|
||||
* function arguments
|
||||
* promote if set, promote left type before comparision; used for
|
||||
* comparisions of arguments with parameters of old style
|
||||
* promote if set, promote left type before comparison; used for
|
||||
* comparisons of arguments with parameters of old style
|
||||
* definitions
|
||||
* asgn left indirected type must have at least the same qualifiers
|
||||
* like right indirected type (for assignments and function
|
||||
|
@ -1290,9 +1169,7 @@ chkadecl(hte, def, decl)
|
|||
* an incompatible prototype declaration
|
||||
*/
|
||||
static int
|
||||
eqtype(tp1, tp2, ignqual, promot, asgn, warn)
|
||||
type_t *tp1, *tp2;
|
||||
int ignqual, promot, asgn, *warn;
|
||||
eqtype(type_t *tp1, type_t *tp2, int ignqual, int promot, int asgn, int *warn)
|
||||
{
|
||||
tspec_t t, to;
|
||||
int indir;
|
||||
|
@ -1322,7 +1199,7 @@ eqtype(tp1, tp2, ignqual, promot, asgn, warn)
|
|||
if (indir == 1 && (t == VOID || tp2->t_tspec == VOID))
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
if (t != tp2->t_tspec) {
|
||||
/*
|
||||
* Give pointer to types which differ only in
|
||||
|
@ -1339,6 +1216,13 @@ eqtype(tp1, tp2, ignqual, promot, asgn, warn)
|
|||
return (tp1->t_tag == tp2->t_tag);
|
||||
} else if (tp1->t_istynam && tp2->t_istynam) {
|
||||
return (tp1->t_tynam == tp2->t_tynam);
|
||||
} else if (tp1->t_isuniqpos && tp2->t_isuniqpos) {
|
||||
return (tp1->t_uniqpos.p_line ==
|
||||
tp2->t_uniqpos.p_line &&
|
||||
tp1->t_uniqpos.p_file ==
|
||||
tp2->t_uniqpos.p_file &&
|
||||
tp1->t_uniqpos.p_uniq ==
|
||||
tp2->t_uniqpos.p_uniq);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
|
@ -1366,6 +1250,13 @@ eqtype(tp1, tp2, ignqual, promot, asgn, warn)
|
|||
return (tp1->t_tag == tp2->t_tag);
|
||||
} else if (tp1->t_istynam && tp2->t_istynam) {
|
||||
return (tp1->t_tynam == tp2->t_tynam);
|
||||
} else if (tp1->t_isuniqpos && tp2->t_isuniqpos) {
|
||||
return (tp1->t_uniqpos.p_line ==
|
||||
tp2->t_uniqpos.p_line &&
|
||||
tp1->t_uniqpos.p_file ==
|
||||
tp2->t_uniqpos.p_file &&
|
||||
tp1->t_uniqpos.p_uniq ==
|
||||
tp2->t_uniqpos.p_uniq);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
|
@ -1404,9 +1295,7 @@ eqtype(tp1, tp2, ignqual, promot, asgn, warn)
|
|||
* Compares arguments of two prototypes
|
||||
*/
|
||||
static int
|
||||
eqargs(tp1, tp2, warn)
|
||||
type_t *tp1, *tp2;
|
||||
int *warn;
|
||||
eqargs(type_t *tp1, type_t *tp2, int *warn)
|
||||
{
|
||||
type_t **a1, **a2;
|
||||
|
||||
|
@ -1440,9 +1329,7 @@ eqargs(tp1, tp2, warn)
|
|||
* is applied on it
|
||||
*/
|
||||
static int
|
||||
mnoarg(tp, warn)
|
||||
type_t *tp;
|
||||
int *warn;
|
||||
mnoarg(type_t *tp, int *warn)
|
||||
{
|
||||
type_t **arg;
|
||||
tspec_t t;
|
||||
|
@ -1459,4 +1346,3 @@ mnoarg(tp, warn)
|
|||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: emit2.c,v 1.2 1995/07/03 21:24:44 cgd Exp $ */
|
||||
/* $NetBSD: emit2.c,v 1.8 2002/01/21 19:49:52 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
|
@ -31,24 +32,23 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: emit2.c,v 1.2 1995/07/03 21:24:44 cgd Exp $";
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: emit2.c,v 1.8 2002/01/21 19:49:52 tv Exp $");
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
|
||||
#include "lint2.h"
|
||||
|
||||
static void outtype __P((type_t *));
|
||||
static void outdef __P((hte_t *, sym_t *));
|
||||
static void dumpname __P((hte_t *));
|
||||
static void outtype(type_t *);
|
||||
static void outdef(hte_t *, sym_t *);
|
||||
static void dumpname(hte_t *);
|
||||
static void outfiles(void);
|
||||
|
||||
/*
|
||||
* Write type into the output buffer.
|
||||
*/
|
||||
static void
|
||||
outtype(tp)
|
||||
type_t *tp;
|
||||
outtype(type_t *tp)
|
||||
{
|
||||
int t, s, na;
|
||||
tspec_t ts;
|
||||
|
@ -105,9 +105,15 @@ outtype(tp)
|
|||
} else if (tp->t_istynam) {
|
||||
outint(2);
|
||||
outname(tp->t_tynam->h_name);
|
||||
} else {
|
||||
outint(0);
|
||||
}
|
||||
} else if (tp->t_isuniqpos) {
|
||||
outint(3);
|
||||
outint(tp->t_uniqpos.p_line);
|
||||
outchar('.');
|
||||
outint(tp->t_uniqpos.p_file);
|
||||
outchar('.');
|
||||
outint(tp->t_uniqpos.p_uniq);
|
||||
} else
|
||||
errx(1, "internal error: outtype() 2");
|
||||
} else if (ts == FUNC && tp->t_args != NULL) {
|
||||
na = 0;
|
||||
for (ap = tp->t_args; *ap != NULL; ap++)
|
||||
|
@ -128,10 +134,9 @@ outtype(tp)
|
|||
* Write a definition.
|
||||
*/
|
||||
static void
|
||||
outdef(hte, sym)
|
||||
hte_t *hte;
|
||||
sym_t *sym;
|
||||
outdef(hte_t *hte, sym_t *sym)
|
||||
{
|
||||
|
||||
/* reset output buffer */
|
||||
outclr();
|
||||
|
||||
|
@ -180,8 +185,7 @@ outdef(hte, sym)
|
|||
* Write the first definition of a name into the lint library.
|
||||
*/
|
||||
static void
|
||||
dumpname(hte)
|
||||
hte_t *hte;
|
||||
dumpname(hte_t *hte)
|
||||
{
|
||||
sym_t *sym, *def;
|
||||
|
||||
|
@ -191,7 +195,7 @@ dumpname(hte)
|
|||
|
||||
/*
|
||||
* If there is a definition, write it. Otherwise write a tentative
|
||||
* definition. This is neccessary because more than one tentative
|
||||
* definition. This is necessary because more than one tentative
|
||||
* definition is allowed (except with sflag).
|
||||
*/
|
||||
def = NULL;
|
||||
|
@ -213,8 +217,7 @@ dumpname(hte)
|
|||
* Write a new lint library.
|
||||
*/
|
||||
void
|
||||
outlib(name)
|
||||
const char *name;
|
||||
outlib(const char *name)
|
||||
{
|
||||
/* Open of output file and initialisation of the output buffer */
|
||||
outopen(name);
|
||||
|
@ -228,9 +231,67 @@ outlib(name)
|
|||
outchar('s');
|
||||
outstrg(name);
|
||||
|
||||
/*
|
||||
* print the names of all files references by unnamed
|
||||
* struct/union/enum declarations.
|
||||
*/
|
||||
outfiles();
|
||||
|
||||
/* write all definitions with external linkage */
|
||||
forall(dumpname);
|
||||
|
||||
/* close the output */
|
||||
outclose();
|
||||
}
|
||||
|
||||
/*
|
||||
* Write out the name of a file referenced by a type.
|
||||
*/
|
||||
struct outflist {
|
||||
short ofl_num;
|
||||
struct outflist *ofl_next;
|
||||
};
|
||||
static struct outflist *outflist;
|
||||
|
||||
int
|
||||
addoutfile(short num)
|
||||
{
|
||||
struct outflist *ofl, **pofl;
|
||||
int i;
|
||||
|
||||
ofl = outflist;
|
||||
pofl = &outflist;
|
||||
i = 1; /* library is 0 */
|
||||
|
||||
while (ofl != NULL) {
|
||||
if (ofl->ofl_num == num)
|
||||
break;
|
||||
|
||||
pofl = &ofl->ofl_next;
|
||||
ofl = ofl->ofl_next;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (ofl == NULL) {
|
||||
ofl = *pofl = xmalloc(sizeof (struct outflist));
|
||||
ofl->ofl_num = num;
|
||||
ofl->ofl_next = NULL;
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
static void
|
||||
outfiles(void)
|
||||
{
|
||||
struct outflist *ofl;
|
||||
int i;
|
||||
|
||||
for (ofl = outflist, i = 1; ofl != NULL; ofl = ofl->ofl_next, i++) {
|
||||
/* reset output buffer */
|
||||
outclr();
|
||||
|
||||
outint(i);
|
||||
outchar('s');
|
||||
outstrg(fnames[ofl->ofl_num]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: externs2.h,v 1.2 1995/07/03 21:24:46 cgd Exp $ */
|
||||
/* $NetBSD: externs2.h,v 1.7 2001/05/28 12:40:38 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
|
@ -38,7 +39,6 @@ extern int xflag;
|
|||
extern int uflag;
|
||||
extern int Cflag;
|
||||
extern const char *libname;
|
||||
extern int pflag;
|
||||
extern int sflag;
|
||||
extern int tflag;
|
||||
extern int Hflag;
|
||||
|
@ -49,9 +49,14 @@ extern int Fflag;
|
|||
/*
|
||||
* hash.c
|
||||
*/
|
||||
extern void inithash __P((void));
|
||||
extern hte_t *hsearch __P((const char *, int));
|
||||
extern void forall __P((void (*)(hte_t *)));
|
||||
extern void _inithash(hte_t ***);
|
||||
extern hte_t *_hsearch(hte_t **, const char *, int);
|
||||
extern void _forall(hte_t **, void (*)(hte_t *));
|
||||
extern void _destroyhash(hte_t **);
|
||||
|
||||
#define inithash() _inithash(NULL);
|
||||
#define hsearch(a, b) _hsearch(NULL, (a), (b))
|
||||
#define forall(a) _forall(NULL, (a))
|
||||
|
||||
/*
|
||||
* read.c
|
||||
|
@ -59,29 +64,30 @@ extern void forall __P((void (*)(hte_t *)));
|
|||
extern const char **fnames;
|
||||
extern type_t **tlst;
|
||||
|
||||
extern void readfile __P((const char *));
|
||||
extern void mkstatic __P((hte_t *));
|
||||
extern void readfile(const char *);
|
||||
extern void mkstatic(hte_t *);
|
||||
|
||||
/*
|
||||
* mem2.c
|
||||
*/
|
||||
extern void initmem __P((void));
|
||||
extern void *xalloc __P((size_t));
|
||||
extern void initmem(void);
|
||||
extern void *xalloc(size_t);
|
||||
|
||||
/*
|
||||
* chk.c
|
||||
*/
|
||||
extern void inittyp __P((void));
|
||||
extern void mainused __P((void));
|
||||
extern void chkname __P((hte_t *));
|
||||
extern void inittyp(void);
|
||||
extern void mainused(void);
|
||||
extern void chkname(hte_t *);
|
||||
|
||||
/*
|
||||
* msg.c
|
||||
*/
|
||||
extern void msg __P((int, ...));
|
||||
extern const char *mkpos __P((pos_t *));
|
||||
extern void msg(int, ...);
|
||||
extern const char *mkpos(pos_t *);
|
||||
|
||||
/*
|
||||
* emit2.c
|
||||
*/
|
||||
extern void outlib __P((const char *));
|
||||
extern void outlib(const char *);
|
||||
extern int addoutfile(short);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hash.c,v 1.2 1995/07/03 21:24:47 cgd Exp $ */
|
||||
/* $NetBSD: hash.c,v 1.7 2002/01/21 19:49:52 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -31,36 +31,45 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: hash.c,v 1.2 1995/07/03 21:24:47 cgd Exp $";
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: hash.c,v 1.7 2002/01/21 19:49:52 tv Exp $");
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
/*
|
||||
* XXX Really need a generalized hash table package
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lint2.h"
|
||||
|
||||
/* pointer to hash table, initialized in inithash() */
|
||||
static hte_t **htab;
|
||||
|
||||
static int hash __P((const char *));
|
||||
static int hash(const char *);
|
||||
|
||||
/*
|
||||
* Initialize hash table.
|
||||
*/
|
||||
void
|
||||
inithash()
|
||||
_inithash(hte_t ***tablep)
|
||||
{
|
||||
htab = xcalloc(HSHSIZ2, sizeof (hte_t *));
|
||||
|
||||
if (tablep == NULL)
|
||||
tablep = &htab;
|
||||
|
||||
*tablep = xcalloc(HSHSIZ2, sizeof (hte_t *));
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute hash value from a string.
|
||||
*/
|
||||
static int
|
||||
hash(s)
|
||||
const char *s;
|
||||
hash(const char *s)
|
||||
{
|
||||
u_int v;
|
||||
const u_char *us;
|
||||
|
@ -78,15 +87,16 @@ hash(s)
|
|||
* given name exists and mknew is set, create a new one.
|
||||
*/
|
||||
hte_t *
|
||||
hsearch(s, mknew)
|
||||
const char *s;
|
||||
int mknew;
|
||||
_hsearch(hte_t **table, const char *s, int mknew)
|
||||
{
|
||||
int h;
|
||||
hte_t *hte;
|
||||
|
||||
if (table == NULL)
|
||||
table = htab;
|
||||
|
||||
h = hash(s);
|
||||
for (hte = htab[h]; hte != NULL; hte = hte->h_link) {
|
||||
for (hte = table[h]; hte != NULL; hte = hte->h_link) {
|
||||
if (strcmp(hte->h_name, s) == 0)
|
||||
break;
|
||||
}
|
||||
|
@ -95,13 +105,20 @@ hsearch(s, mknew)
|
|||
return (hte);
|
||||
|
||||
/* create a new hte */
|
||||
hte = xalloc(sizeof (hte_t));
|
||||
hte = xmalloc(sizeof (hte_t));
|
||||
hte->h_name = xstrdup(s);
|
||||
hte->h_used = 0;
|
||||
hte->h_def = 0;
|
||||
hte->h_static = 0;
|
||||
hte->h_syms = NULL;
|
||||
hte->h_lsym = &hte->h_syms;
|
||||
hte->h_calls = NULL;
|
||||
hte->h_lcall = &hte->h_calls;
|
||||
hte->h_usyms = NULL;
|
||||
hte->h_lusym = &hte->h_usyms;
|
||||
hte->h_link = htab[h];
|
||||
htab[h] = hte;
|
||||
hte->h_link = table[h];
|
||||
hte->h_hte = NULL;
|
||||
table[h] = hte;
|
||||
|
||||
return (hte);
|
||||
}
|
||||
|
@ -110,14 +127,38 @@ hsearch(s, mknew)
|
|||
* Call function f for each name in the hash table.
|
||||
*/
|
||||
void
|
||||
forall(f)
|
||||
void (*f) __P((hte_t *));
|
||||
_forall(hte_t **table, void (*f)(hte_t *))
|
||||
{
|
||||
int i;
|
||||
hte_t *hte;
|
||||
|
||||
if (table == NULL)
|
||||
table = htab;
|
||||
|
||||
for (i = 0; i < HSHSIZ2; i++) {
|
||||
for (hte = htab[i]; hte != NULL; hte = hte->h_link)
|
||||
for (hte = table[i]; hte != NULL; hte = hte->h_link)
|
||||
(*f)(hte);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free all contents of the hash table that this module allocated.
|
||||
*/
|
||||
void
|
||||
_destroyhash(hte_t **table)
|
||||
{
|
||||
int i;
|
||||
hte_t *hte, *nexthte;
|
||||
|
||||
if (table == NULL)
|
||||
err(1, "_destroyhash called on main hash table");
|
||||
|
||||
for (i = 0; i < HSHSIZ2; i++) {
|
||||
for (hte = table[i]; hte != NULL; hte = nexthte) {
|
||||
free((void *)hte->h_name);
|
||||
nexthte = hte->h_link;
|
||||
free(hte);
|
||||
}
|
||||
}
|
||||
free(table);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: lint2.h,v 1.2 1995/07/03 21:24:49 cgd Exp $ */
|
||||
/* $NetBSD: lint2.h,v 1.5 2000/06/14 06:49:23 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
* All Rights Reserved.
|
||||
*
|
||||
|
@ -45,6 +46,7 @@ typedef struct type {
|
|||
u_int t_proto : 1; /* this is a prototype */
|
||||
u_int t_istag : 1; /* tag with _t_tag valid */
|
||||
u_int t_istynam : 1; /* tag with _t_tynam valid */
|
||||
u_int t_isuniqpos : 1; /* tag with _t_uniqpos valid */
|
||||
union {
|
||||
int _t_dim; /* if the type is an ARRAY than this
|
||||
is the dimension of the array. */
|
||||
|
@ -52,6 +54,13 @@ typedef struct type {
|
|||
t_isenum, STRUCT or UNION */
|
||||
struct hte *_t_tynam; /* hash table entry of typename if
|
||||
t_isenum, STRUCT or UNION */
|
||||
struct {
|
||||
int p_line;
|
||||
short p_file;
|
||||
int p_uniq;
|
||||
} _t_uniqpos; /* unique position, for untagged
|
||||
untyped STRUCTs, UNIONS, and ENUMs,
|
||||
if t_isuniqpos */
|
||||
struct type **_t_args; /* list of argument types if this
|
||||
is a prototype */
|
||||
} t_u;
|
||||
|
@ -59,10 +68,11 @@ typedef struct type {
|
|||
type, type of return value) */
|
||||
} type_t;
|
||||
|
||||
#define t_dim t_u._t_dim
|
||||
#define t_tag t_u._t_tag
|
||||
#define t_tynam t_u._t_tynam
|
||||
#define t_args t_u._t_args
|
||||
#define t_dim t_u._t_dim
|
||||
#define t_tag t_u._t_tag
|
||||
#define t_tynam t_u._t_tynam
|
||||
#define t_uniqpos t_u._t_uniqpos
|
||||
#define t_args t_u._t_args
|
||||
|
||||
/*
|
||||
* argument information
|
||||
|
@ -90,7 +100,7 @@ typedef struct {
|
|||
u_short p_line; /* line number in p_src */
|
||||
u_short p_isrc; /* index of (included) file */
|
||||
u_short p_iline; /* line number in p_iline */
|
||||
} pos_t;
|
||||
} pos_t;
|
||||
|
||||
/*
|
||||
* Used for definitions and declarations
|
||||
|
@ -107,7 +117,7 @@ typedef struct sym {
|
|||
u_int s_def : 3; /* DECL, TDEF or DEF */
|
||||
#else
|
||||
def_t s_def;
|
||||
#endif
|
||||
#endif
|
||||
u_int s_rval : 1; /* function has return value */
|
||||
u_int s_osdef : 1; /* old style function definition */
|
||||
u_int s_static : 1; /* symbol is static */
|
||||
|
@ -169,6 +179,7 @@ typedef struct hte {
|
|||
usym_t *h_usyms; /* usage info */
|
||||
usym_t **h_lusym; /* points to u_nxt of last usage info */
|
||||
struct hte *h_link; /* next hte with same hash function */
|
||||
struct hte *h_hte; /* pointer to other htes (for renames */
|
||||
} hte_t;
|
||||
|
||||
/* maps type indices into pointers to type structs */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main2.c,v 1.2 1995/07/03 21:24:53 cgd Exp $ */
|
||||
/* $NetBSD: main2.c,v 1.5 2001/11/21 19:14:26 wiz Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -31,8 +31,9 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: main2.c,v 1.2 1995/07/03 21:24:53 cgd Exp $";
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: main2.c,v 1.5 2001/11/21 19:14:26 wiz Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -58,7 +59,7 @@ const char *libname;
|
|||
int pflag;
|
||||
|
||||
/*
|
||||
* warnings for (tentative) definitions of the same name in more then
|
||||
* warnings for (tentative) definitions of the same name in more than
|
||||
* one translation unit
|
||||
*/
|
||||
int sflag;
|
||||
|
@ -83,13 +84,12 @@ int Fflag;
|
|||
*/
|
||||
const char **libs;
|
||||
|
||||
static void usage __P((void));
|
||||
static void usage(void);
|
||||
|
||||
int main(int, char *[]);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int c, i;
|
||||
size_t len;
|
||||
|
@ -133,8 +133,9 @@ main(argc, argv)
|
|||
Fflag = 1;
|
||||
break;
|
||||
case 'l':
|
||||
for (i = 0; libs[i] != NULL; i++) ;
|
||||
libs = xrealloc(libs, (i + 2) * sizeof (char *));
|
||||
for (i = 0; libs[i] != NULL; i++)
|
||||
continue;
|
||||
libs = xrealloc(libs, (i + 2) * sizeof (char *));
|
||||
libs[i] = xstrdup(optarg);
|
||||
libs[i + 1] = NULL;
|
||||
break;
|
||||
|
@ -142,7 +143,7 @@ main(argc, argv)
|
|||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
|
@ -181,10 +182,9 @@ main(argc, argv)
|
|||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: lint2 -hpstxuHF -Clib -l lib ... src1 ...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msg.c,v 1.2 1995/07/03 21:24:56 cgd Exp $ */
|
||||
/* $NetBSD: msg.c,v 1.6 2002/01/21 19:49:52 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -31,22 +31,17 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: msg.c,v 1.2 1995/07/03 21:24:56 cgd Exp $";
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: msg.c,v 1.6 2002/01/21 19:49:52 tv Exp $");
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#include "lint2.h"
|
||||
|
||||
|
||||
static const char *msgs[] = {
|
||||
"%s used( %s ), but not defined", /* 0 */
|
||||
"%s defined( %s ), but never used", /* 1 */
|
||||
|
@ -66,29 +61,17 @@ static const char *msgs[] = {
|
|||
"%s: too few args for format \t%s", /* 15 */
|
||||
"%s: too many args for format \t%s", /* 16 */
|
||||
"%s function value must be declared before use \t%s :: %s",/* 17 */
|
||||
"%s renamed multiple times \t%s :: %s", /* 18 */
|
||||
};
|
||||
|
||||
static const char *basename __P((const char *));
|
||||
static const char *lbasename(const char *);
|
||||
|
||||
#ifdef __STDC__
|
||||
void
|
||||
msg(int n, ...)
|
||||
{
|
||||
#else
|
||||
void
|
||||
msg(va_alist)
|
||||
va_dcl
|
||||
int n;
|
||||
{
|
||||
#endif
|
||||
va_list ap;
|
||||
|
||||
#ifdef __STDC__
|
||||
va_start(ap, n);
|
||||
#else
|
||||
va_start(ap);
|
||||
n = va_arg(ap, int);
|
||||
#endif
|
||||
|
||||
(void)vprintf(msgs[n], ap);
|
||||
(void)printf("\n");
|
||||
|
@ -100,8 +83,7 @@ msg(va_alist)
|
|||
* Return a pointer to the last component of a path.
|
||||
*/
|
||||
static const char *
|
||||
basename(path)
|
||||
const char *path;
|
||||
lbasename(const char *path)
|
||||
{
|
||||
const char *cp, *cp1, *cp2;
|
||||
|
||||
|
@ -122,8 +104,7 @@ basename(path)
|
|||
* Create a string which describes a position in a source file.
|
||||
*/
|
||||
const char *
|
||||
mkpos(posp)
|
||||
pos_t *posp;
|
||||
mkpos(pos_t *posp)
|
||||
{
|
||||
size_t len;
|
||||
const char *fn;
|
||||
|
@ -140,7 +121,7 @@ mkpos(posp)
|
|||
}
|
||||
qm = !Hflag && posp->p_src != posp->p_isrc;
|
||||
|
||||
len = strlen(fn = basename(fnames[src]));
|
||||
len = strlen(fn = lbasename(fnames[src]));
|
||||
len += 3 * sizeof (u_short) + 4;
|
||||
|
||||
if (len > blen)
|
||||
|
@ -154,4 +135,3 @@ mkpos(posp)
|
|||
|
||||
return (buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: llib-lposix,v 1.2 1995/07/03 21:25:09 cgd Exp $ */
|
||||
/* $NetBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
|
Loading…
Reference in a new issue