@@ -4922,8 +4922,8 @@ Gid_t getegid (void);
4922
4922
# define DEBUG_Lv_TEST DEBUG_Lv_TEST_
4923
4923
# define DEBUG_yv_TEST DEBUG_yv_TEST_
4924
4924
4925
- # define PERL_DEB (a ) a
4926
- # define PERL_DEB2 (a,b ) a
4925
+ # define PERL_IF_DEBUGGING (a ) a
4926
+ # define PERL_IF_DEBUGGING_ELSE (a,b ) a
4927
4927
# define PERL_DEBUG (a ) if (PL_debug) a
4928
4928
# define DEBUG_p (a ) if (DEBUG_p_TEST) a
4929
4929
# define DEBUG_s (a ) if (DEBUG_s_TEST) a
@@ -5051,8 +5051,8 @@ Gid_t getegid (void);
5051
5051
# define DEBUG_Lv_TEST (0 )
5052
5052
# define DEBUG_yv_TEST (0 )
5053
5053
5054
- # define PERL_DEB (a )
5055
- # define PERL_DEB2 (a,b ) b
5054
+ # define PERL_IF_DEBUGGING (a )
5055
+ # define PERL_IF_DEBUGGING_ELSE (a,b ) b
5056
5056
# define PERL_DEBUG (a )
5057
5057
# define DEBUG_p (a )
5058
5058
# define DEBUG_s (a )
@@ -5088,6 +5088,90 @@ Gid_t getegid (void);
5088
5088
#endif /* DEBUGGING */
5089
5089
5090
5090
5091
+ /*
5092
+ =for apidoc_section $debugging
5093
+ =for apidoc mu||PERL_IF_DEBUGGING|code
5094
+
5095
+ A macro which is executed only when DEBUGGING is enabled.
5096
+ Functionally identical to
5097
+
5098
+ #ifdef DEBUGGING
5099
+ code
5100
+ #endif
5101
+
5102
+ but prettier. This macro is useful for declaring variables that are
5103
+ only used on DEBUGGING builds. Note that what this macro does is
5104
+ determined at compile time, if you want a run time equivalent then
5105
+ use C<PERL_DEBUG()> instead.
5106
+
5107
+ =for apidoc mu||PERL_IF_DEBUGGING_ELSE|code_debugging|code_nondebugging
5108
+
5109
+ A macro way of expressing different code that should be compiled
5110
+ depending on whether DEBUGGING is enabled. Functionally identical
5111
+ to
5112
+
5113
+ #ifdef DEBUGGING
5114
+ code_debugging
5115
+ #else
5116
+ code_nondebugging
5117
+ #end
5118
+
5119
+ but prettier.
5120
+
5121
+ =for apidoc mu||PERL_DEBUG|code
5122
+ A macro way of expressing code that will only be executed when the run
5123
+ time internal variable PL_debug is non-zero.
5124
+
5125
+ =for apidoc mu||DEBUG_A|code
5126
+ =for apidoc_item mu||DEBUG_B|code
5127
+ =for apidoc_item mu||DEBUG_C|code
5128
+ =for apidoc_item mu||DEBUG_c|code
5129
+ =for apidoc_item mu||DEBUG_D|code
5130
+ =for apidoc_item mu||DEBUG_f|code
5131
+ =for apidoc_item mu||DEBUG_i|code
5132
+ =for apidoc_item mu||DEBUG_L|code
5133
+ =for apidoc_item mu||DEBUG_l|code
5134
+ =for apidoc_item mu||DEBUG_Lv|code
5135
+ =for apidoc_item mu||DEBUG_m|code
5136
+ =for apidoc_item mu||DEBUG_o|code
5137
+ =for apidoc_item mu||DEBUG_P|code
5138
+ =for apidoc_item mu||DEBUG_p|code
5139
+ =for apidoc_item mu||DEBUG_Pv|code
5140
+ =for apidoc_item mu||DEBUG_q|code
5141
+ =for apidoc_item mu||DEBUG_R|code
5142
+ =for apidoc_item mu||DEBUG_r|code
5143
+ =for apidoc_item mu||DEBUG_S|code
5144
+ =for apidoc_item mu||DEBUG_s|code
5145
+ =for apidoc_item mu||DEBUG_T|code
5146
+ =for apidoc_item mu||DEBUG_t|code
5147
+ =for apidoc_item mu||DEBUG_U|code
5148
+ =for apidoc_item mu||DEBUG_u|code
5149
+ =for apidoc_item mu||DEBUG_Uv|code
5150
+ =for apidoc_item mu||DEBUG_V|code
5151
+ =for apidoc_item mu||DEBUG_X|code
5152
+ =for apidoc_item mu||DEBUG_x|code
5153
+ =for apidoc_item mu||DEBUG_Xv|code
5154
+ =for apidoc_item mu||DEBUG_y|code
5155
+ =for apidoc_item mu||DEBUG_yv|code
5156
+
5157
+ These are debugging macros similar to PERL_DEBUG() but which test
5158
+ which flags in PL_debug have been set. Each letter corresponds to
5159
+ a mode exposed by the -D option to perl. These macros only execute
5160
+ when DEBUGGING is enabled, and when the appropriate debug mode
5161
+ has been enabled on the command line.
5162
+
5163
+ See L<perlrun> for details on the meaning of the different
5164
+ switches.
5165
+
5166
+ =cut
5167
+ */
5168
+
5169
+ /* these are for backwards compatibility, just in case anything out
5170
+ * in the wild (eg CPAN) is using them. */
5171
+ #define PERL_DEB (a ) PERL_IF_DEBUGGING(a)
5172
+ #define PERL_DEB2 (a,b ) PERL_IF_DEBUGGING_ELSE(a,b)
5173
+
5174
+
5091
5175
#define DEBUG_SCOPE (where ) \
5092
5176
DEBUG_l ( \
5093
5177
Perl_deb (aTHX_ " %s scope %ld (savestack=%ld) at %s:%d\n " , \
@@ -5097,7 +5181,7 @@ Gid_t getegid (void);
5097
5181
/* Keep the old croak based assert for those who want it, and as a fallback if
5098
5182
the platform is so heretically non-ANSI that it can't assert. */
5099
5183
5100
- #define Perl_assert (what ) PERL_DEB2( \
5184
+ #define Perl_assert (what ) PERL_IF_DEBUGGING_ELSE( \
5101
5185
((what) ? ((void ) 0 ) : \
5102
5186
(Perl_croak_nocontext (" Assertion %s failed: file \" " __FILE__ \
5103
5187
" \" , line %d" , STRINGIFY (what), __LINE__), \
0 commit comments