Print this page
remove support for non-ANSI compilation


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*


  22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*
  27  * Copyright (c) 2012 by Delphix. All rights reserved.
  28  */
  29 
  30 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  31 /*        All Rights Reserved   */
  32 
  33 #ifndef _SYS_DEBUG_H
  34 #define _SYS_DEBUG_H
  35 
  36 #include <sys/isa_defs.h>
  37 #include <sys/types.h>
  38 #include <sys/note.h>
  39 
  40 #ifdef  __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 /*
  45  * ASSERT(ex) causes a panic or debugger entry if expression ex is not
  46  * true.  ASSERT() is included only for debugging, and is a no-op in
  47  * production kernels.  VERIFY(ex), on the other hand, behaves like
  48  * ASSERT and is evaluated on both debug and non-debug kernels.
  49  */
  50 
  51 #if defined(__STDC__)
  52 extern int assfail(const char *, const char *, int);
  53 #define VERIFY(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__)))
  54 #if DEBUG
  55 #define ASSERT(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__)))
  56 #else
  57 #define ASSERT(x)  ((void)0)
  58 #endif
  59 #else   /* defined(__STDC__) */
  60 extern int assfail();
  61 #define VERIFY(EX) ((void)((EX) || assfail("EX", __FILE__, __LINE__)))
  62 #if DEBUG
  63 #define ASSERT(EX) ((void)((EX) || assfail("EX", __FILE__, __LINE__)))
  64 #else
  65 #define ASSERT(x)  ((void)0)
  66 #endif
  67 #endif  /* defined(__STDC__) */
  68 
  69 /*
  70  * Assertion variants sensitive to the compilation data model
  71  */
  72 #if defined(_LP64)
  73 #define ASSERT64(x)     ASSERT(x)
  74 #define ASSERT32(x)
  75 #else
  76 #define ASSERT64(x)
  77 #define ASSERT32(x)     ASSERT(x)
  78 #endif
  79 
  80 /*
  81  * IMPLY and EQUIV are assertions of the form:
  82  *
  83  *      if (a) then (b)
  84  * and
  85  *      if (a) then (b) *AND* if (b) then (a)
  86  */
  87 #if DEBUG




   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  23  *
  24  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*
  29  * Copyright (c) 2012 by Delphix. All rights reserved.
  30  */
  31 
  32 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  33 /*        All Rights Reserved   */
  34 
  35 #ifndef _SYS_DEBUG_H
  36 #define _SYS_DEBUG_H
  37 
  38 #include <sys/isa_defs.h>
  39 #include <sys/types.h>
  40 #include <sys/note.h>
  41 
  42 #ifdef  __cplusplus
  43 extern "C" {
  44 #endif
  45 
  46 /*
  47  * ASSERT(ex) causes a panic or debugger entry if expression ex is not
  48  * true.  ASSERT() is included only for debugging, and is a no-op in
  49  * production kernels.  VERIFY(ex), on the other hand, behaves like
  50  * ASSERT and is evaluated on both debug and non-debug kernels.
  51  */
  52 

  53 extern int assfail(const char *, const char *, int);
  54 #define VERIFY(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__)))
  55 #if DEBUG
  56 #define ASSERT(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__)))
  57 #else
  58 #define ASSERT(x)  ((void)0)
  59 #endif









  60 
  61 /*
  62  * Assertion variants sensitive to the compilation data model
  63  */
  64 #if defined(_LP64)
  65 #define ASSERT64(x)     ASSERT(x)
  66 #define ASSERT32(x)
  67 #else
  68 #define ASSERT64(x)
  69 #define ASSERT32(x)     ASSERT(x)
  70 #endif
  71 
  72 /*
  73  * IMPLY and EQUIV are assertions of the form:
  74  *
  75  *      if (a) then (b)
  76  * and
  77  *      if (a) then (b) *AND* if (b) then (a)
  78  */
  79 #if DEBUG