~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/lib/zstd/common/debug.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /lib/zstd/common/debug.h (Version linux-6.12-rc7) and /lib/zstd/common/debug.h (Version linux-5.16.20)


  1 /* *******************************************      1 /* ******************************************************************
  2  * debug                                            2  * debug
  3  * Part of FSE library                              3  * Part of FSE library
  4  * Copyright (c) Yann Collet, Facebook, Inc.        4  * Copyright (c) Yann Collet, Facebook, Inc.
  5  *                                                  5  *
  6  * You can contact the author at :                  6  * You can contact the author at :
  7  * - Source repository : https://github.com/Cy      7  * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
  8  *                                                  8  *
  9  * This source code is licensed under both the      9  * This source code is licensed under both the BSD-style license (found in the
 10  * LICENSE file in the root directory of this      10  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 11  * in the COPYING file in the root directory o     11  * in the COPYING file in the root directory of this source tree).
 12  * You may select, at your option, one of the      12  * You may select, at your option, one of the above-listed licenses.
 13 **********************************************     13 ****************************************************************** */
 14                                                    14 
 15                                                    15 
 16 /*                                                 16 /*
 17  * The purpose of this header is to enable deb     17  * The purpose of this header is to enable debug functions.
 18  * They regroup assert(), DEBUGLOG() and RAWLO     18  * They regroup assert(), DEBUGLOG() and RAWLOG() for run-time,
 19  * and DEBUG_STATIC_ASSERT() for compile-time.     19  * and DEBUG_STATIC_ASSERT() for compile-time.
 20  *                                                 20  *
 21  * By default, DEBUGLEVEL==0, which means run-     21  * By default, DEBUGLEVEL==0, which means run-time debug is disabled.
 22  *                                                 22  *
 23  * Level 1 enables assert() only.                  23  * Level 1 enables assert() only.
 24  * Starting level 2, traces can be generated a     24  * Starting level 2, traces can be generated and pushed to stderr.
 25  * The higher the level, the more verbose the      25  * The higher the level, the more verbose the traces.
 26  *                                                 26  *
 27  * It's possible to dynamically adjust level u     27  * It's possible to dynamically adjust level using variable g_debug_level,
 28  * which is only declared if DEBUGLEVEL>=2,        28  * which is only declared if DEBUGLEVEL>=2,
 29  * and is a global variable, not multi-thread      29  * and is a global variable, not multi-thread protected (use with care)
 30  */                                                30  */
 31                                                    31 
 32 #ifndef DEBUG_H_12987983217                        32 #ifndef DEBUG_H_12987983217
 33 #define DEBUG_H_12987983217                        33 #define DEBUG_H_12987983217
 34                                                    34 
 35                                                    35 
 36                                                    36 
 37 /* static assert is triggered at compile time,     37 /* static assert is triggered at compile time, leaving no runtime artefact.
 38  * static assert only works with compile-time      38  * static assert only works with compile-time constants.
 39  * Also, this variant can only be used inside      39  * Also, this variant can only be used inside a function. */
 40 #define DEBUG_STATIC_ASSERT(c) (void)sizeof(ch     40 #define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
 41                                                    41 
 42                                                    42 
 43 /* DEBUGLEVEL is expected to be defined extern     43 /* DEBUGLEVEL is expected to be defined externally,
 44  * typically through compiler command line.        44  * typically through compiler command line.
 45  * Value must be a number. */                      45  * Value must be a number. */
 46 #ifndef DEBUGLEVEL                                 46 #ifndef DEBUGLEVEL
 47 #  define DEBUGLEVEL 0                             47 #  define DEBUGLEVEL 0
 48 #endif                                             48 #endif
 49                                                    49 
 50                                                    50 
 51 /* recommended values for DEBUGLEVEL :             51 /* recommended values for DEBUGLEVEL :
 52  * 0 : release mode, no debug, all run-time ch     52  * 0 : release mode, no debug, all run-time checks disabled
 53  * 1 : enables assert() only, no display           53  * 1 : enables assert() only, no display
 54  * 2 : reserved, for currently active debug pa     54  * 2 : reserved, for currently active debug path
 55  * 3 : events once per object lifetime (CCtx,      55  * 3 : events once per object lifetime (CCtx, CDict, etc.)
 56  * 4 : events once per frame                       56  * 4 : events once per frame
 57  * 5 : events once per block                       57  * 5 : events once per block
 58  * 6 : events once per sequence (verbose)          58  * 6 : events once per sequence (verbose)
 59  * 7+: events at every position (*very* verbos     59  * 7+: events at every position (*very* verbose)
 60  *                                                 60  *
 61  * It's generally inconvenient to output trace     61  * It's generally inconvenient to output traces > 5.
 62  * In which case, it's possible to selectively     62  * In which case, it's possible to selectively trigger high verbosity levels
 63  * by modifying g_debug_level.                     63  * by modifying g_debug_level.
 64  */                                                64  */
 65                                                    65 
 66 #if (DEBUGLEVEL>=1)                                66 #if (DEBUGLEVEL>=1)
 67 #  define ZSTD_DEPS_NEED_ASSERT                    67 #  define ZSTD_DEPS_NEED_ASSERT
 68 #  include "zstd_deps.h"                           68 #  include "zstd_deps.h"
 69 #else                                              69 #else
 70 #  ifndef assert   /* assert may be already de     70 #  ifndef assert   /* assert may be already defined, due to prior #include <assert.h> */
 71 #    define assert(condition) ((void)0)   /* d     71 #    define assert(condition) ((void)0)   /* disable assert (default) */
 72 #  endif                                           72 #  endif
 73 #endif                                             73 #endif
 74                                                    74 
 75 #if (DEBUGLEVEL>=2)                                75 #if (DEBUGLEVEL>=2)
 76 #  define ZSTD_DEPS_NEED_IO                        76 #  define ZSTD_DEPS_NEED_IO
 77 #  include "zstd_deps.h"                           77 #  include "zstd_deps.h"
 78 extern int g_debuglevel; /* the variable is on     78 extern int g_debuglevel; /* the variable is only declared,
 79                             it actually lives      79                             it actually lives in debug.c,
 80                             and is shared by t     80                             and is shared by the whole process.
 81                             It's not thread-sa     81                             It's not thread-safe.
 82                             It's useful when e     82                             It's useful when enabling very verbose levels
 83                             on selective condi     83                             on selective conditions (such as position in src) */
 84                                                    84 
 85 #  define RAWLOG(l, ...) {                         85 #  define RAWLOG(l, ...) {                                       \
 86                 if (l<=g_debuglevel) {             86                 if (l<=g_debuglevel) {                           \
 87                     ZSTD_DEBUG_PRINT(__VA_ARGS     87                     ZSTD_DEBUG_PRINT(__VA_ARGS__);               \
 88             }   }                                  88             }   }
 89 #  define DEBUGLOG(l, ...) {                       89 #  define DEBUGLOG(l, ...) {                                     \
 90                 if (l<=g_debuglevel) {             90                 if (l<=g_debuglevel) {                           \
 91                     ZSTD_DEBUG_PRINT(__FILE__      91                     ZSTD_DEBUG_PRINT(__FILE__ ": " __VA_ARGS__); \
 92                     ZSTD_DEBUG_PRINT(" \n");       92                     ZSTD_DEBUG_PRINT(" \n");                     \
 93             }   }                                  93             }   }
 94 #else                                              94 #else
 95 #  define RAWLOG(l, ...)      {}    /* disable     95 #  define RAWLOG(l, ...)      {}    /* disabled */
 96 #  define DEBUGLOG(l, ...)    {}    /* disable     96 #  define DEBUGLOG(l, ...)    {}    /* disabled */
 97 #endif                                             97 #endif
 98                                                    98 
 99                                                    99 
100                                                   100 
101 #endif /* DEBUG_H_12987983217 */                  101 #endif /* DEBUG_H_12987983217 */
102                                                   102 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php