corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [09/33] incubator-corinthia git commit: Fix OS X build breakage in DFError.h
Date Fri, 13 Feb 2015 08:21:38 GMT
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/experiment64
Commit: cc208a6d44534fea95a5fa2f4bcc7f733b58fd89
Parents: 3f11aef
Author: Peter Kelly <peter@uxproductivity.com>
Authored: Sun Jan 11 00:48:26 2015 +0700
Committer: Peter Kelly <peter@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;
 


Mime
View raw message