Difference between revisions of "Source:NetHack 3.6.0/include/lint.h"

From NetHackWiki
Jump to navigation Jump to search
(Created page with "__MIXEDSYNTAXHIGHLIGHT__ Below is the full text to '''lint.h''' from the source code of NetHack 3.6.0. To link to a particular line, write ...")
 
 
Line 3: Line 3:
  
 
{{NGPL}}
 
{{NGPL}}
  <span id="line1">1.   /* NetHack 3.6 lint.h $NHDT-Date: 1449269910 2015/12/04 22:58:30 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.3 $ */</span>
+
  <span id="line1">1. /* NetHack 3.6 lint.h $NHDT-Date: 1449269910 2015/12/04 22:58:30 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.3 $ */</span>
  <span id="line2">2.   /* NetHack may be freely redistributed.  See license for details. */</span>
+
  <span id="line2">2. /* NetHack may be freely redistributed.  See license for details. */</span>
  <span id="line3">3.   </span>
+
  <span id="line3">3. </span>
  <span id="line4">4.   /*</span>
+
  <span id="line4">4. /*</span>
  <span id="line5">5.     * Hacks to suppress compiler warnings.  Use with caution.</span>
+
  <span id="line5">5.  * Hacks to suppress compiler warnings.  Use with caution.</span>
  <span id="line6">6.     * Assumes it has been preceded by '#include "config.h"' but</span>
+
  <span id="line6">6.  * Assumes it has been preceded by '#include "config.h"' but</span>
  <span id="line7">7.     * not necessarily by '#include "hack.h"'.</span>
+
  <span id="line7">7.  * not necessarily by '#include "hack.h"'.</span>
  <span id="line8">8.     */</span>
+
  <span id="line8">8.  */</span>
  <span id="line9">9.   #ifndef LINT_H</span>
+
  <span id="line9">9. #ifndef LINT_H</span>
  <span id="line10">10.   #define LINT_H</span>
+
  <span id="line10">10. #define LINT_H</span>
  <span id="line11">11.   </span>
+
  <span id="line11">11. </span>
  <span id="line12">12.   /* cast away implicit const from a string literal (caller's responsibility</span>
+
  <span id="line12">12. /* cast away implicit const from a string literal (caller's responsibility</span>
  <span id="line13">13.     to ensure that) in order to avoid a warning from 'gcc -Wwrite-strings'</span>
+
  <span id="line13">13.   to ensure that) in order to avoid a warning from 'gcc -Wwrite-strings'</span>
  <span id="line14">14.     (also caller's responsibility to ensure it isn't actually modified!) */</span>
+
  <span id="line14">14.   (also caller's responsibility to ensure it isn't actually modified!) */</span>
  <span id="line15">15.   #define nhStr(str) ((char *) str)</span>
+
  <span id="line15">15. #define nhStr(str) ((char *) str)</span>
  <span id="line16">16.   </span>
+
  <span id="line16">16. </span>
  <span id="line17">17.   #if defined(GCC_WARN) && !defined(FORCE_ARG_USAGE)</span>
+
  <span id="line17">17. #if defined(GCC_WARN) && !defined(FORCE_ARG_USAGE)</span>
  <span id="line18">18.   #define FORCE_ARG_USAGE</span>
+
  <span id="line18">18. #define FORCE_ARG_USAGE</span>
  <span id="line19">19.   #endif</span>
+
  <span id="line19">19. #endif</span>
  <span id="line20">20.   </span>
+
  <span id="line20">20. </span>
  <span id="line21">21.   #ifdef FORCE_ARG_USAGE</span>
+
  <span id="line21">21. #ifdef FORCE_ARG_USAGE</span>
  <span id="line22">22.   /* force an unused function argument to become used in an arbitrary</span>
+
  <span id="line22">22. /* force an unused function argument to become used in an arbitrary</span>
  <span id="line23">23.     manner in order to suppress warning about unused function arguments;</span>
+
  <span id="line23">23.   manner in order to suppress warning about unused function arguments;</span>
  <span id="line24">24.     viable for scalar and pointer arguments */</span>
+
  <span id="line24">24.   viable for scalar and pointer arguments */</span>
  <span id="line25">25.   #define nhUse(arg) nhUse_dummy += (unsigned) arg;</span>
+
  <span id="line25">25. #define nhUse(arg) nhUse_dummy += (unsigned) arg;</span>
  <span id="line26">26.   extern unsigned nhUse_dummy;</span>
+
  <span id="line26">26. extern unsigned nhUse_dummy;</span>
  <span id="line27">27.   #else</span>
+
  <span id="line27">27. #else</span>
  <span id="line28">28.   #define nhUse(arg) /*empty*/</span>
+
  <span id="line28">28. #define nhUse(arg) /*empty*/</span>
  <span id="line29">29.   #endif</span>
+
  <span id="line29">29. #endif</span>
  <span id="line30">30.   </span>
+
  <span id="line30">30. </span>
  <span id="line31">31.   /*</span>
+
  <span id="line31">31. /*</span>
  <span id="line32">32.   * This stuff isn't related to lint suppression but lives here to</span>
+
  <span id="line32">32.  * This stuff isn't related to lint suppression but lives here to</span>
  <span id="line33">33.   * avoid cluttering up hack.h.</span>
+
  <span id="line33">33.  * avoid cluttering up hack.h.</span>
  <span id="line34">34.   */</span>
+
  <span id="line34">34.  */</span>
  <span id="line35">35.   /* [DEBUG shouldn't be defined unless you know what you're doing...] */</span>
+
  <span id="line35">35. /* [DEBUG shouldn't be defined unless you know what you're doing...] */</span>
  <span id="line36">36.   #ifdef DEBUG</span>
+
  <span id="line36">36. #ifdef DEBUG</span>
  <span id="line37">37.   #define showdebug(file) debugcore(file, TRUE)</span>
+
  <span id="line37">37. #define showdebug(file) debugcore(file, TRUE)</span>
  <span id="line38">38.   #define explicitdebug(file) debugcore(file, FALSE)</span>
+
  <span id="line38">38. #define explicitdebug(file) debugcore(file, FALSE)</span>
  <span id="line39">39.   #define ifdebug(stmt)                  \</span>
+
  <span id="line39">39. #define ifdebug(stmt)                  \</span>
  <span id="line40">40.       do {                                \</span>
+
  <span id="line40">40.     do {                                \</span>
  <span id="line41">41.           if (showdebug(__FILE__)) {      \</span>
+
  <span id="line41">41.         if (showdebug(__FILE__)) {      \</span>
  <span id="line42">42.               stmt;                      \</span>
+
  <span id="line42">42.             stmt;                      \</span>
  <span id="line43">43.           }                              \</span>
+
  <span id="line43">43.         }                              \</span>
  <span id="line44">44.       } while (0)</span>
+
  <span id="line44">44.     } while (0)</span>
  <span id="line45">45.   #ifdef _MSC_VER</span>
+
  <span id="line45">45. #ifdef _MSC_VER</span>
  <span id="line46">46.   /* if we have microsoft's C runtime we can use these instead */</span>
+
  <span id="line46">46. /* if we have microsoft's C runtime we can use these instead */</span>
  <span id="line47">47.   #include <crtdbg.h></span>
+
  <span id="line47">47. #include <crtdbg.h></span>
  <span id="line48">48.   #define crtdebug(stmt)                  \</span>
+
  <span id="line48">48. #define crtdebug(stmt)                  \</span>
  <span id="line49">49.       do {                                \</span>
+
  <span id="line49">49.     do {                                \</span>
  <span id="line50">50.           if (showdebug(__FILE__)) {      \</span>
+
  <span id="line50">50.         if (showdebug(__FILE__)) {      \</span>
  <span id="line51">51.               stmt;                      \</span>
+
  <span id="line51">51.             stmt;                      \</span>
  <span id="line52">52.           }                              \</span>
+
  <span id="line52">52.         }                              \</span>
  <span id="line53">53.           _RPT0(_CRT_WARN, "\n");        \</span>
+
  <span id="line53">53.         _RPT0(_CRT_WARN, "\n");        \</span>
  <span id="line54">54.       } while (0)</span>
+
  <span id="line54">54.     } while (0)</span>
  <span id="line55">55.   #define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str))</span>
+
  <span id="line55">55. #define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str))</span>
  <span id="line56">56.   #define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg))</span>
+
  <span id="line56">56. #define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg))</span>
  <span id="line57">57.   #define debugpline2(fmt, a1, a2) crtdebug(_RPT2(_CRT_WARN, fmt, a1, a2))</span>
+
  <span id="line57">57. #define debugpline2(fmt, a1, a2) crtdebug(_RPT2(_CRT_WARN, fmt, a1, a2))</span>
  <span id="line58">58.   #define debugpline3(fmt, a1, a2, a3) \</span>
+
  <span id="line58">58. #define debugpline3(fmt, a1, a2, a3) \</span>
  <span id="line59">59.       crtdebug(_RPT3(_CRT_WARN, fmt, a1, a2, a3))</span>
+
  <span id="line59">59.     crtdebug(_RPT3(_CRT_WARN, fmt, a1, a2, a3))</span>
  <span id="line60">60.   #define debugpline4(fmt, a1, a2, a3, a4) \</span>
+
  <span id="line60">60. #define debugpline4(fmt, a1, a2, a3, a4) \</span>
  <span id="line61">61.       crtdebug(_RPT4(_CRT_WARN, fmt, a1, a2, a3, a4))</span>
+
  <span id="line61">61.     crtdebug(_RPT4(_CRT_WARN, fmt, a1, a2, a3, a4))</span>
  <span id="line62">62.   #else</span>
+
  <span id="line62">62. #else</span>
  <span id="line63">63.   /* these don't require compiler support for C99 variadic macros */</span>
+
  <span id="line63">63. /* these don't require compiler support for C99 variadic macros */</span>
  <span id="line64">64.   #define debugpline0(str) ifdebug(pline(str))</span>
+
  <span id="line64">64. #define debugpline0(str) ifdebug(pline(str))</span>
  <span id="line65">65.   #define debugpline1(fmt, arg) ifdebug(pline(fmt, arg))</span>
+
  <span id="line65">65. #define debugpline1(fmt, arg) ifdebug(pline(fmt, arg))</span>
  <span id="line66">66.   #define debugpline2(fmt, a1, a2) ifdebug(pline(fmt, a1, a2))</span>
+
  <span id="line66">66. #define debugpline2(fmt, a1, a2) ifdebug(pline(fmt, a1, a2))</span>
  <span id="line67">67.   #define debugpline3(fmt, a1, a2, a3) ifdebug(pline(fmt, a1, a2, a3))</span>
+
  <span id="line67">67. #define debugpline3(fmt, a1, a2, a3) ifdebug(pline(fmt, a1, a2, a3))</span>
  <span id="line68">68.   #define debugpline4(fmt, a1, a2, a3, a4) ifdebug(pline(fmt, a1, a2, a3, a4))</span>
+
  <span id="line68">68. #define debugpline4(fmt, a1, a2, a3, a4) ifdebug(pline(fmt, a1, a2, a3, a4))</span>
  <span id="line69">69.   #endif</span>
+
  <span id="line69">69. #endif</span>
  <span id="line70">70.   #else</span>
+
  <span id="line70">70. #else</span>
  <span id="line71">71.   #define debugpline0(str)                /*empty*/</span>
+
  <span id="line71">71. #define debugpline0(str)                /*empty*/</span>
  <span id="line72">72.   #define debugpline1(fmt, arg)            /*empty*/</span>
+
  <span id="line72">72. #define debugpline1(fmt, arg)            /*empty*/</span>
  <span id="line73">73.   #define debugpline2(fmt, a1, a2)        /*empty*/</span>
+
  <span id="line73">73. #define debugpline2(fmt, a1, a2)        /*empty*/</span>
  <span id="line74">74.   #define debugpline3(fmt, a1, a2, a3)    /*empty*/</span>
+
  <span id="line74">74. #define debugpline3(fmt, a1, a2, a3)    /*empty*/</span>
  <span id="line75">75.   #define debugpline4(fmt, a1, a2, a3, a4) /*empty*/</span>
+
  <span id="line75">75. #define debugpline4(fmt, a1, a2, a3, a4) /*empty*/</span>
  <span id="line76">76.   #endif                                  /*DEBUG*/</span>
+
  <span id="line76">76. #endif                                  /*DEBUG*/</span>
  <span id="line77">77.   </span>
+
  <span id="line77">77. </span>
  <span id="line78">78.   #endif /* LINT_H */</span>
+
  <span id="line78">78. #endif /* LINT_H */</span>
 
[[Category:NetHack 3.6.0 source code|include/lint.h]]
 
[[Category:NetHack 3.6.0 source code|include/lint.h]]

Latest revision as of 13:27, 15 December 2015

Below is the full text to lint.h from the source code of NetHack 3.6.0. To link to a particular line, write [[Source:NetHack 3.6.0/include/lint.h#line123]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

 /* NetHack 3.6	lint.h	$NHDT-Date: 1449269910 2015/12/04 22:58:30 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.3 $ */
 /* NetHack may be freely redistributed.  See license for details. */
 
 /*
  * Hacks to suppress compiler warnings.  Use with caution.
  * Assumes it has been preceded by '#include "config.h"' but
  * not necessarily by '#include "hack.h"'.
  */
 #ifndef LINT_H
 #define LINT_H
 
 /* cast away implicit const from a string literal (caller's responsibility
    to ensure that) in order to avoid a warning from 'gcc -Wwrite-strings'
    (also caller's responsibility to ensure it isn't actually modified!) */
 #define nhStr(str) ((char *) str)
 
 #if defined(GCC_WARN) && !defined(FORCE_ARG_USAGE)
 #define FORCE_ARG_USAGE
 #endif
 
 #ifdef FORCE_ARG_USAGE
 /* force an unused function argument to become used in an arbitrary
    manner in order to suppress warning about unused function arguments;
    viable for scalar and pointer arguments */
 #define nhUse(arg) nhUse_dummy += (unsigned) arg;
 extern unsigned nhUse_dummy;
 #else
 #define nhUse(arg) /*empty*/
 #endif
 
 /*
  * This stuff isn't related to lint suppression but lives here to
  * avoid cluttering up hack.h.
  */
 /* [DEBUG shouldn't be defined unless you know what you're doing...] */
 #ifdef DEBUG
 #define showdebug(file) debugcore(file, TRUE)
 #define explicitdebug(file) debugcore(file, FALSE)
 #define ifdebug(stmt)                   \
     do {                                \
         if (showdebug(__FILE__)) {      \
             stmt;                       \
         }                               \
     } while (0)
 #ifdef _MSC_VER
 /* if we have microsoft's C runtime we can use these instead */
 #include <crtdbg.h>
 #define crtdebug(stmt)                  \
     do {                                \
         if (showdebug(__FILE__)) {      \
             stmt;                       \
         }                               \
         _RPT0(_CRT_WARN, "\n");         \
     } while (0)
 #define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str))
 #define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg))
 #define debugpline2(fmt, a1, a2) crtdebug(_RPT2(_CRT_WARN, fmt, a1, a2))
 #define debugpline3(fmt, a1, a2, a3) \
     crtdebug(_RPT3(_CRT_WARN, fmt, a1, a2, a3))
 #define debugpline4(fmt, a1, a2, a3, a4) \
     crtdebug(_RPT4(_CRT_WARN, fmt, a1, a2, a3, a4))
 #else
 /* these don't require compiler support for C99 variadic macros */
 #define debugpline0(str) ifdebug(pline(str))
 #define debugpline1(fmt, arg) ifdebug(pline(fmt, arg))
 #define debugpline2(fmt, a1, a2) ifdebug(pline(fmt, a1, a2))
 #define debugpline3(fmt, a1, a2, a3) ifdebug(pline(fmt, a1, a2, a3))
 #define debugpline4(fmt, a1, a2, a3, a4) ifdebug(pline(fmt, a1, a2, a3, a4))
 #endif
 #else
 #define debugpline0(str)                 /*empty*/
 #define debugpline1(fmt, arg)            /*empty*/
 #define debugpline2(fmt, a1, a2)         /*empty*/
 #define debugpline3(fmt, a1, a2, a3)     /*empty*/
 #define debugpline4(fmt, a1, a2, a3, a4) /*empty*/
 #endif                                   /*DEBUG*/
 
 #endif /* LINT_H */