co-gcc.lnt 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /* Date Stamp */ -d"_lint_co_gcc_lnt=co-gcc.lnt modified 12-Jun-2014"
  2. /* To document usage use: -message( "Using " _lint_co_gcc_lnt ) */
  3. // ---------------------------------------------------------------------
  4. // This file is provided by Gimpel Software (www.gimpel.com) for use with
  5. // its products PC-lint and FlexeLint.
  6. //
  7. // Redistribution and use of this file, with or without modification, is
  8. // permitted provided that any such redistribution retains this notice.
  9. // ---------------------------------------------------------------------
  10. /* co-gcc.lnt: This is the seed file for configuring Lint for use with
  11. GCC versions 2.95.3 and later.
  12. Like all compiler options files this file is intended to be used
  13. as follows:
  14. lint co-gcc.lnt source-files-to-be-linted
  15. Some of the information that co-gcc.lnt requires needs to be furnished
  16. with the help of the gcc system itself. The easiest way to generate
  17. this information is to use the makefile co-gcc.mak (supplied with the
  18. Lint distribution) in an invocation of GNU Make; for details, see the
  19. commentary at the top of co-gcc.mak.
  20. */
  21. -cgnu // Notifies FlexeLint that gcc is being used.
  22. // ===========================
  23. // Preprocessor Configuration:
  24. +fdi // GCC starts its #include search in the directory of the including
  25. // file.
  26. ++fln // Allow:
  27. // # digit-sequence " [s-char-sequence] " new-line
  28. // as a synonym for:
  29. // # line digit-sequence " [s-char-sequence] " new-line
  30. // GCC additionally allows flag values to follow the
  31. // s-char-sequence, but currently Lint ignores them.
  32. -header(pclint/co-gcc.h) // Includes headers generated by GCC (bringing in
  33. // predefined macros).
  34. +libh(pclint/co-gcc.h) // Marks that header as library code.
  35. pclint/gcc-include-path.lnt // This .lnt file should contain --i options
  36. // and should be generated by invoking gcc with its '-v' option.
  37. // (GCC's implicit #include search path is presented in the output.)
  38. // This happens automatically when 'make -f co-gcc.mak' is invoked.
  39. // Assertion directives (a feature of GCC's preprocessor) have been
  40. // considered obsolete in GCC's documentation since version 3.0, so we do
  41. // not use them here. If support for #assert is needed in the form of a
  42. // lint option, one may use '-a#' like so:
  43. // -a#machine(i386) // #assert's machine(i386) (SVR4 facility).
  44. // File extensions:
  45. // From the GCC man page:
  46. //
  47. // file.cc
  48. // file.cp
  49. // file.cxx
  50. // file.cpp
  51. // file.CPP
  52. // file.c++
  53. // file.C
  54. // C++ source code that must be preprocessed. Note that in .cxx, the
  55. // last two letters must both be literally x. Likewise, .C refers to
  56. // a literal capital C.
  57. //
  58. // We emulate this with:
  59. +cpp(.cc)
  60. +cpp(.cp)
  61. +cpp(.cxx)
  62. +cpp(.cpp)
  63. +cpp(.c++)
  64. // Note the exceptions:
  65. // +cpp(.CPP)
  66. // +cpp(.C)
  67. // These are commented out for the default config because they seem to
  68. // cause trouble more often than not. For starters, it is problematic
  69. // with filesystems that are case-insensitive (which has become common
  70. // even on some POSIX systems).
  71. // =============
  72. // Size Options:
  73. // +fwc // wchar_t might be builtin; if so, uncomment this option. (NOTE:
  74. // // this option needs to be set before a size option is given for
  75. // // wchar_t; see the documentation for -sw# in the Lint manual.)
  76. pclint/size-options.lnt // This .lnt file should be generated (preferrably
  77. // by a program created by invoking GCC with the compile options that
  78. // are used in the compilation of the project to be linted). This
  79. // happens automatically when 'make -f co-gcc.mak' is invoked.
  80. // ===========================================
  81. // +rw and -d options to cope with GNU syntax:
  82. +ppw(ident) // Tolerate #ident
  83. +ppw(warning)
  84. // GCC provides alternative spellings of certain keywords:
  85. +rw(__inline)
  86. -rw_asgn(__inline__,__inline)
  87. -rw_asgn(__header_always_inline,__inline)
  88. -rw_asgn(__header_inline,__inline)
  89. -rw_asgn(__signed__,signed)
  90. -rw_asgn(__signed,signed)
  91. -rw_asgn( __volatile__, volatile )
  92. -rw_asgn( __volatile, volatile )
  93. +rw(restrict)
  94. -rw_asgn(__restrict,restrict)
  95. -rw_asgn(__restrict__,restrict)
  96. ++d"__const=const" // gconv.h uses __const rather than const
  97. ++d"const=const" // ensure const expands to const.
  98. -rw_asgn( asm, _up_to_brackets )
  99. -rw_asgn( __asm, _up_to_brackets )
  100. -rw_asgn( __asm__, _up_to_brackets )
  101. // This re-definition of the various spellings of the asm keyword enables
  102. // Lint to pass gracefully over expression-statements like:
  103. // __asm __volatile ("fsqrt" : "=t" (__result) : "0" (__x));
  104. // But it may be necessary to suppress certain error messages that are
  105. // triggered by tokens that are part of an assembly declaration or
  106. // statement. For example:
  107. // -d"__asm__(p...)=/*lint -e{19}*/ __asm__(p)"
  108. // ...causes Lint to be quiet about the semicolon that follows an
  109. // __asm__() declaration. Note, the -e{N} form of suppression takes
  110. // effect only for the forward-declaration, definition or
  111. // [possibly-compound] statement that immediately follows. Because a
  112. // semicolon is seen as a declaration-terminator, Error 19 will be
  113. // re-enabled immediately after the semicolon in '__asm__(...);'.
  114. // (The elipsis after the macro parameter p allows zero or more commas to
  115. // appear in the operand.)
  116. //
  117. // If you encounter other diagnostics that appear to need suppression in
  118. // or near assembly regions, please let us know!
  119. //
  120. -esym(123,__asm__)
  121. -rw_asgn(__alignof__,__alignof)
  122. // "__extension__" is GCC's way of allowing the use of non-standard
  123. // constructs in a strict Standard-conforming mode. We don't currently
  124. // have explicit support for it, but we can use local suppressions. For
  125. // example, we can use -e(160) so that we will not see any Errors about
  126. // GNU statement-expressions wrapped in __extension__().
  127. ++d"__extension__=/*lint -e(160) */"
  128. ++d"__null=0"
  129. +rw(_to_semi) // needed for the two macros above.
  130. +rw(__typeof__) // activate __typeof__ keyword
  131. -d"__typeof=__typeof__" // an alternative to using __typeof__
  132. -rw(__except) // This MS reserved word is used as an identifier
  133. +rw( __complex__, __real__, __imag__ ) // reserved words that can be ignored.
  134. ++d"__builtin_strchr=(char*)" // permits the inline definition ...
  135. ++d"__builtin_strpbrk=(char*)" // of these functions to be linted ...
  136. ++d"__builtin_strrchr=(char*)" // without drawing a complaint
  137. ++d"__builtin_strstr=(char*)" // about the use of a non-standard name
  138. ++d"__PRETTY_FUNCTION__=___function___" // lint defines ___function___ internally
  139. ++d"__FUNCTION__=___function___" // lint defines ___function___ internally
  140. ++d"__func__=___function___" // Some C++ modes suport the implicit __func__
  141. // identifier.
  142. -ident($)
  143. // =========================================================
  144. // Other options supporting GNU C/C++ syntax:
  145. +fld // enables the processing of _L_abel _D_esignators E.g.:
  146. // union { double d; int i; } u = { d: 3.141 };
  147. // =========================================================
  148. // Generally useful suppressions:
  149. -wlib(1) // sets the warning level within library headers to 1
  150. // (no warnings, just syntax errors). Comment out if you
  151. // are actually linting library headers.
  152. -elib(123) // 123 is really a warning, but it's in the "Error" range.
  153. -elib(93) // allow newlines within quoted string arguments to macros
  154. -elib(46) // allow bit fields to have integral types other than
  155. // '_Bool' and 'int'.
  156. -elibsym(628) // Suppress 628 for __builtin symbols.
  157. -esym(528,__huge_val,__nan,__qnan,__qnanf,__snan,__snanf)
  158. // We don't care if we don't reference some GNU functions
  159. -esym(528,__gnu_malloc,__gnu_calloc)
  160. // The following functions exhibit variable return modes.
  161. // That is, they may equally-usefully be called for a value
  162. // as called just for their effects. Accordingly we inhibit
  163. // Warning 534 for these functions.
  164. // Feel free to add to or subtract from this list.
  165. -esym(534,close,creat,fclose,fprintf,fputc)
  166. -esym(534,fputs,fscanf,fseek,fwrite,lseek,memcpy,memmove,memset)
  167. -esym(534,printf,puts,scanf,sprintf,sscanf,strcat,strcpy)
  168. -esym(534,strncat,strncpy,unlink,write)
  169. // For non-ANSI compilers we suppress messages 515 and 516
  170. // for functions known to have variable argument lists.
  171. // For ANSI compilers, header files should take care of this.
  172. -esym(515,fprintf,printf,sprintf,fscanf,scanf,sscanf)
  173. -esym(516,fprintf,printf,sprintf,fscanf,scanf,sscanf)
  174. -esym(1702,*operator<<,*operator>>)
  175. -esym(534,*operator<<,*operator>>)
  176. -esym(1055,*__builtin*)
  177. -esym(718,*__builtin*) // The compiler does not need these ...
  178. -esym(746,*__builtin*) // declared and it knows their prototypes.