1 /* svn_debug.h : handy little debug tools for the SVN developers
3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
27 #define SVN_DBG__PROTOTYPES
30 #ifdef SVN_DBG__PROTOTYPES
31 #define APR_WANT_STDIO
38 #endif /* __cplusplus */
40 #ifdef SVN_DBG__PROTOTYPES
41 /* A few helper functions for the macros below. */
43 svn_dbg__preamble(const char *file, long line, FILE *output);
45 svn_dbg__printf(const char *fmt, ...)
46 __attribute__((format(printf, 1, 2)));
48 svn_dbg__print_props(apr_hash_t *props,
49 const char *header_fmt,
51 __attribute__((format(printf, 2, 3)));
54 /* Only available when SVN_DEBUG is defined (ie. svn developers). Note that
55 we do *not* provide replacement macros/functions for proper releases.
56 The debug stuff should be removed before a commit.
58 ### maybe we will eventually decide to allow certain debug stuff to
59 ### remain in the code. at that point, we can rejigger this header. */
62 /* Print to stdout. Edit this line if you need stderr. */
63 #define SVN_DBG_OUTPUT stdout
66 /* Defining this symbol in the source file, BEFORE INCLUDING THIS HEADER,
67 will switch off the output. Calls will still be made to svn_dbg__preamble()
71 #define SVN_DBG(ARGS) svn_dbg__preamble(__FILE__, __LINE__, NULL)
72 #define SVN_DBG_PROPS(ARGS) svn_dbg__preamble(__FILE__, __LINE__, NULL)
76 /** Debug aid macro that prints the file:line of the call and printf-like
77 * arguments to the #SVN_DBG_OUTPUT stdio stream (#stdout by default). Typical
81 * SVN_DBG(("rev=%ld kind=%s\n", revnum, svn_node_kind_to_word(kind)));
87 * DBG: kitchensink.c: 42: rev=3141592 kind=file
90 * Note that these output lines are filtered by our test suite automatically,
91 * so you don't have to worry about throwing off expected output.
93 #define SVN_DBG(ARGS) (svn_dbg__preamble(__FILE__, __LINE__, SVN_DBG_OUTPUT), \
95 #define SVN_DBG_PROPS(ARGS) (svn_dbg__preamble(__FILE__, __LINE__, \
97 svn_dbg__print_props ARGS)
101 #endif /* SVN_DEBUG */
105 #endif /* __cplusplus */
107 #endif /* SVN_DEBUG_H */