1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/lib/util/fault.h
Lukas Slebodnik 9643a4b1ef lib/util: Include DEBUG macro in internal header files before samba_util.h
It's best practice to include external header files before internal
header files. In this case internal DEBUG macro cannot be defined and
therefore samba version of debug macro will be included
in header file "util/fault.h".

In file included from example.c:27:0:
src/util/util.h:127:0: error: "DEBUG" redefined [-Werror]
 #define DEBUG(level, format, ...) do { \
 ^
In file included from /usr/include/samba-4.0/util/fault.h:29:0,
                 from /usr/include/samba-4.0/samba_util.h:62,
                 from /usr/include/samba-4.0/ndr.h:30,
                 from example.c:24:
/usr/include/samba-4.0/util/debug.h:182:0: note: this is the location of the previous definition
 #define DEBUG( level, body ) \
 ^
  CC       src/providers/ad/libsss_ad_common_la-ad_domain_info.lo
cc1: all warnings being treated as errors

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11033

Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 11 18:47:22 CET 2015 on sn-devel-104
2015-03-11 18:47:22 +01:00

58 lines
1.5 KiB
C

/*
Unix SMB/CIFS implementation.
Critical Fault handling
Copyright (C) Andrew Tridgell 1992-1998
Copyright (C) Tim Prouty 2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SAMBA_FAULT_H_
#define _SAMBA_FAULT_H_
#include <sys/types.h>
#include "attr.h"
/* Please include header file debug.h if you want to use macro SMB_ASSERT */
/**
* assert macros
*/
#ifdef _SAMBA_DEBUG_H
#define SMB_ASSERT(b) \
do { \
if (!(b)) { \
DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \
__FILE__, __LINE__, #b)); \
smb_panic("assert failed: " #b); \
} \
} while(0)
#endif /* _SAMBA_DEBUG_H */
extern const char *panic_action;
/**
Something really nasty happened - panic !
**/
typedef void (*smb_panic_handler_t)(const char *why);
void fault_configure(smb_panic_handler_t panic_handler);
void fault_setup(void);
void fault_setup_disable(void);
_NORETURN_ void smb_panic(const char *reason);
#endif /* _SAMBA_FAULT_H_ */