[Pixman] [PATCH 1/4] New option to build pixman as C++ code (--enable-enforced-cplusplus)

Siarhei Siamashka siarhei.siamashka at gmail.com
Sat Dec 15 21:13:47 PST 2012


First of all, there is no intention to start relying on any C++
features for the normal production builds of pixman which are
shipped to end users. The C programming language is just fine.

However building pixman as C++ code may be sometimes useful for
testing and development purposes. C++ is particularly anal about
type safety and also allows defining classes for custom data types
with operators overloading. It may be handy for the special debugging
builds where we can enforce strict rules about what and how can be
done with pixman_fixed_t and pixman_fixed_48_16_t, forbid uncontrolled
casts between integer and fixed point types, implement custom checks
at runtime for detecting overflows or any other potential problems.
---
 configure.ac       |   14 ++++++++++++++
 pixman/Makefile.am |    2 ++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 81f068d..c3f8875 100644
--- a/configure.ac
+++ b/configure.ac
@@ -754,6 +754,20 @@ fi
 AC_SUBST(TESTPROGS_EXTRA_LDFLAGS)
 
 dnl ==============================================
+dnl Force compilation of pixman library in C++ mode (for testing/debugging)
+
+AC_ARG_ENABLE(enforced-cplusplus,
+   [AC_HELP_STRING([--enable-enforced-cplusplus],
+		   [unsupported C++ test build [default=no]])],
+   [enable_enforced_cplusplus=$enableval], [enable_enforced_cplusplus=no])
+
+PIXMAN_EXTRA_CPPFLAGS=
+if test "x$enable_enforced_cplusplus" = "xyes" ; then
+   PIXMAN_EXTRA_CPPFLAGS="$PIXMAN_EXTRA_CPPFLAGS -xc++"
+fi
+AC_SUBST(PIXMAN_EXTRA_CPPFLAGS)
+
+dnl ==============================================
 dnl Timers
 
 AC_ARG_ENABLE(timers,
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index cbed085..b0ce7fa 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -1,5 +1,7 @@
 include $(top_srcdir)/pixman/Makefile.sources
 
+AM_CPPFLAGS = $(PIXMAN_EXTRA_CPPFLAGS)
+
 lib_LTLIBRARIES = libpixman-1.la
 
 libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined @PTHREAD_LDFLAGS@ 
-- 
1.7.8.6



More information about the Pixman mailing list