Skip to content

Commit

Permalink
Moved __printflike() from PlatformCompat.hh to Base.h
Browse files Browse the repository at this point in the history
It's now used in Fleece.h
  • Loading branch information
snej committed May 1, 2021
1 parent ff0ef0a commit 0a7efd6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 10 additions & 0 deletions API/fleece/Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
// Typically this is because the return value is something that must be released/freed.
#define MUST_USE_RESULT __attribute__((warn_unused_result))

#ifndef __printflike
// Declares this function takes a printf-like format string, and the subsequent args should
// be type-checked against it.
#define __printflike(fmtarg, varg) __attribute__((__format__ (__printf__, fmtarg, varg)))
#endif

// These have no effect on behavior, but they hint to the optimizer which branch of an 'if'
// statement to make faster.
#define _usuallyTrue(VAL) __builtin_expect(VAL, true)
Expand All @@ -46,6 +52,10 @@
#define RETURNS_NONNULL
#define MUST_USE_RESULT

#ifndef __printflike
#define __printflike(fmtarg, varg)
#endif

#define _usuallyTrue(VAL) (VAL)
#define _usuallyFalse(VAL) (VAL)
#endif
Expand Down
8 changes: 0 additions & 8 deletions Fleece/Support/PlatformCompat.hh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

#define MAXFLOAT FLT_MAX

#define __printflike(A, B)

#define cbl_strdup _strdup
#define cbl_getcwd _getcwd

Expand Down Expand Up @@ -73,12 +71,6 @@
#define ASSUME(cond) (void(0))
#endif

// Declares this function takes a printf-like format string, and the subsequent args should
// be type-checked against it.
#ifndef __printflike
#define __printflike(fmtarg, firstvararg) __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
#endif

// Windows has underscore prefixes before these function names, so define a common name
#define cbl_strdup strdup
#define cbl_getcwd getcwd
Expand Down

0 comments on commit 0a7efd6

Please sign in to comment.