/usr.bin/xlint/common/lint.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 126 lines · 73 code · 12 blank · 41 comment · 0 complexity · 6247c3c29bab1f773642ab6e33ca9cdc MD5 · raw file

  1. /* $NetBSD: lint.h,v 1.5 2002/03/07 18:29:56 tv Exp $ */
  2. /*
  3. * Copyright (c) 1994, 1995 Jochen Pohl
  4. * All Rights Reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. All advertising materials mentioning features or use of this software
  15. * must display the following acknowledgement:
  16. * This product includes software developed by Jochen Pohl for
  17. * The NetBSD Project.
  18. * 4. The name of the author may not be used to endorse or promote products
  19. * derived from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  22. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  23. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  25. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  26. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  30. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. */
  32. #if HAVE_CONFIG_H
  33. #include "config.h"
  34. #else
  35. #define HAVE_DECL_SYS_SIGNAME 1
  36. #endif
  37. #include <sys/types.h>
  38. #include <stddef.h>
  39. #include <err.h>
  40. #include <inttypes.h>
  41. #include <stdio.h>
  42. #include "param.h"
  43. /*
  44. * Type specifiers, used in type structures (type_t) and otherwere.
  45. */
  46. typedef enum {
  47. NOTSPEC = 0,
  48. SIGNED, /* keyword "signed", only used in the parser */
  49. UNSIGN, /* keyword "unsigned", only used in the parser */
  50. CHAR, /* char */
  51. SCHAR, /* signed char */
  52. UCHAR, /* unsigned char */
  53. SHORT, /* (signed) short */
  54. USHORT, /* unsigned short */
  55. INT, /* (signed) int */
  56. UINT, /* unsigned int */
  57. LONG, /* (signed) long */
  58. ULONG, /* unsigned long */
  59. QUAD, /* (signed) long long */
  60. UQUAD, /* unsigned long long */
  61. FLOAT, /* float */
  62. DOUBLE, /* double or, with tflag, long float */
  63. LDOUBLE, /* long double */
  64. VOID, /* void */
  65. STRUCT, /* structure tag */
  66. UNION, /* union tag */
  67. ENUM, /* enum tag */
  68. PTR, /* pointer */
  69. ARRAY, /* array */
  70. FUNC, /* function */
  71. NTSPEC
  72. } tspec_t;
  73. /*
  74. * size of types, name and classification
  75. */
  76. typedef struct {
  77. int tt_sz; /* size in bits */
  78. int tt_psz; /* size, different from tt_sz
  79. if pflag is set */
  80. tspec_t tt_styp; /* signed counterpart */
  81. tspec_t tt_utyp; /* unsigned counterpart */
  82. u_int tt_isityp : 1; /* 1 if integer type */
  83. u_int tt_isutyp : 1; /* 1 if unsigned integer type */
  84. u_int tt_isftyp : 1; /* 1 if floating point type */
  85. u_int tt_isatyp : 1; /* 1 if arithmetic type */
  86. u_int tt_issclt : 1; /* 1 if scalar type */
  87. char *tt_name; /* Bezeichnung des Typs */
  88. } ttab_t;
  89. #define size(t) (ttab[t].tt_sz)
  90. #define psize(t) (ttab[t].tt_psz)
  91. #define styp(t) (ttab[t].tt_styp)
  92. #define utyp(t) (ttab[t].tt_utyp)
  93. #define isityp(t) (ttab[t].tt_isityp)
  94. #define isutyp(t) (ttab[t].tt_isutyp)
  95. #define isftyp(t) (ttab[t].tt_isftyp)
  96. #define isatyp(t) (ttab[t].tt_isatyp)
  97. #define issclt(t) (ttab[t].tt_issclt)
  98. extern ttab_t ttab[];
  99. typedef enum {
  100. NODECL, /* until now not declared */
  101. DECL, /* declared */
  102. TDEF, /* tentative defined */
  103. DEF /* defined */
  104. } def_t;
  105. /*
  106. * Following structure contains some data used for the output buffer.
  107. */
  108. typedef struct ob {
  109. char *o_buf; /* buffer */
  110. char *o_end; /* first byte after buffer */
  111. size_t o_len; /* length of buffer */
  112. char *o_nxt; /* next free byte in buffer */
  113. } ob_t;
  114. #include "externs.h"