You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by pm...@apache.org on 2015/01/10 18:55:51 UTC

incubator-corinthia git commit: Fix OS X build breakage in DFError.h

Repository: incubator-corinthia
Updated Branches:
  refs/heads/master 3f11aefa2 -> cc208a6d4


Fix OS X build breakage in DFError.h

Commit e8d93d4 removed the ATTRIBUTE_FORMAT macro from DFError.h, since
this macro is also present in DFPlatform.h. However, DFError.h is part
of the public API, while DFPlatform is not. Consumers that are
configured to compile only against the public API are unable to access
macro definitions in DFPlatform.h, so those macros must be present in
the API headers.

The ATTRIBUTE_FORMAT is used for telling the compiler to check the
arguments to DFErrorFormat to make sure they conform to printf-style
formatting. GCC/Clang and Visual C++ both have a different syntax for
this, which is why a macro is needed.

I'm not sure why gcc on Linux and Visual C++ on windows weren't
complaining about this, but Xcode gave a compile error as the macro was
undefined.

If we want to avoid platform-specific #ifdefs in specific public header
files, we'll need something equivalent to DFPlatform.h which is included
in the public headers. Putting this #ifdef back as-is is a temporary
solution, needed to build the code under Xcode, but ultimately it would
be good if we could come up with a more general solution.


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/cc208a6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/cc208a6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/cc208a6d

Branch: refs/heads/master
Commit: cc208a6d44534fea95a5fa2f4bcc7f733b58fd89
Parents: 3f11aef
Author: Peter Kelly <pe...@uxproductivity.com>
Authored: Sun Jan 11 00:48:26 2015 +0700
Committer: Peter Kelly <pe...@uxproductivity.com>
Committed: Sun Jan 11 00:52:52 2015 +0700

----------------------------------------------------------------------
 DocFormats/api/headers/DocFormats/DFError.h | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/cc208a6d/DocFormats/api/headers/DocFormats/DFError.h
----------------------------------------------------------------------
diff --git a/DocFormats/api/headers/DocFormats/DFError.h b/DocFormats/api/headers/DocFormats/DFError.h
index 5b08fb1..2876007 100644
--- a/DocFormats/api/headers/DocFormats/DFError.h
+++ b/DocFormats/api/headers/DocFormats/DFError.h
@@ -19,6 +19,13 @@
 
 // It's really not nice having this here, but is the only way to get the compiler to typecheck the
 // DFErrorFormat arguments when such functionality is available.
+#ifndef ATTRIBUTE_FORMAT
+#ifdef _MSC_VER
+#define ATTRIBUTE_FORMAT(archetype,index,first)
+#else
+#define ATTRIBUTE_FORMAT(archetype,index,first) __attribute__((format(archetype,index,first)))
+#endif
+#endif
 
 typedef struct DFError DFError;