Skip to content

Commit

Permalink
lib/util: Include DEBUG macro in internal header files before samba_u…
Browse files Browse the repository at this point in the history
…til.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 <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
Reviewed-by: Martin Schwenke <[email protected]>

Autobuild-User(master): Jeremy Allison <[email protected]>
Autobuild-Date(master): Wed Mar 11 18:47:22 CET 2015 on sn-devel-104
  • Loading branch information
Lukas Slebodnik authored and jrasamba committed Mar 11, 2015
1 parent ca59881 commit 9643a4b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions lib/util/fault.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

#include "attr.h"

#ifndef DEBUG
#include "debug.h"
#endif /* DEBUG */
/* Please include header file debug.h if you want to use macro SMB_ASSERT */

/**
* assert macros
Expand Down
2 changes: 1 addition & 1 deletion lib/util/memcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#include "replace.h"
#include <talloc.h>
#include "../lib/util/samba_util.h"
#include "../lib/util/debug.h"
#include "../lib/util/samba_util.h"
#include "../lib/util/dlinklist.h"
#include "../lib/util/rbtree.h"
#include "memcache.h"
Expand Down
4 changes: 3 additions & 1 deletion source3/include/includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ enum timestamp_set_resolution {
typedef char fstring[FSTRING_LEN];
#endif

/* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */
#include "../lib/util/debug.h"

/* Lists, trees, caching, database... */
#include "../lib/util/samba_util.h"
#include "../lib/util/util_net.h"
Expand All @@ -371,7 +374,6 @@ typedef char fstring[FSTRING_LEN];

#include "../lib/util/data_blob.h"
#include "../lib/util/time.h"
#include "../lib/util/debug.h"
#include "../lib/util/debug_s3.h"

#include "../libcli/util/ntstatus.h"
Expand Down
2 changes: 2 additions & 0 deletions source4/include/includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
#endif
#include "../lib/util/xfile.h"
#include "../lib/util/attr.h"

/* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */
#include "../lib/util/debug.h"
#include "../lib/util/samba_util.h"

Expand Down

0 comments on commit 9643a4b

Please sign in to comment.