Author: brane
Date: Wed Nov 28 14:39:42 2012
New Revision: 1414728
URL: http://svn.apache.org/viewvc?rev=1414728&view=rev
Log:
Getting sidetracked for a bit: create placeholder and update build for
a future high-level C++ API for Subversion, based on the same principles
as JavaHL.
* configure.ac: Extend the set of maintainer-mode warning flags for C++.
* Makefile.in (CXXHL_INCLUDES, COMPILE_CXXHL_CXX): New macros.
* build.conf (libsvncxxhl): New top-level build target.
(private-includes): Add C++HL include directories.
* build/generator/gen_make.py: Generate extra install rules for C++HL.
* subversion/bindings/cxxhl: New directory.
* subversion/bindings/cxxhl/README: Describe the design and goals of C++HL.
* subversion/bindings/cxxhl/include/svn_cxxhl_types.h,
subversion/bindings/cxxhl/include/types/svn_cxxhl_tristate.h,
subversion/bindings/cxxhl/src/types/tristate.cpp: Example implementation
of the C++HL wrapper for svn_tristate_t.
Added:
subversion/trunk/subversion/bindings/cxxhl/
subversion/trunk/subversion/bindings/cxxhl/README
subversion/trunk/subversion/bindings/cxxhl/include/
subversion/trunk/subversion/bindings/cxxhl/include/svn_cxxhl_types.h
subversion/trunk/subversion/bindings/cxxhl/include/types/
subversion/trunk/subversion/bindings/cxxhl/include/types/svn_cxxhl_tristate.h
subversion/trunk/subversion/bindings/cxxhl/src/
subversion/trunk/subversion/bindings/cxxhl/src/types/
subversion/trunk/subversion/bindings/cxxhl/src/types/tristate.cpp
Modified:
subversion/trunk/Makefile.in
subversion/trunk/build.conf
subversion/trunk/build/generator/gen_make.py
subversion/trunk/configure.ac
Modified: subversion/trunk/Makefile.in
URL:
http://svn.apache.org/viewvc/subversion/trunk/Makefile.in?rev=1414728&r1=1414727&r2=1414728&view=diff
==============================================================================
--- subversion/trunk/Makefile.in (original)
+++ subversion/trunk/Makefile.in Wed Nov 28 14:39:42 2012
@@ -156,6 +156,8 @@ CTYPES_PYTHON_SRC_DIR = $(abs_srcdir)/su
JAVAHL_JAR=subversion/bindings/javahl/svn-javahl.jar
JAVAHL_INCLUDES= @JNI_INCLUDES@
-I$(abs_builddir)/subversion/bindings/javahl/include
+CXXHL_INCLUDES = -I$(abs_srcdir)/subversion/bindings/cxxhl/include
+
SVN_APR_CONFIG = @SVN_APR_CONFIG@
SVN_APR_INCLUDES = @SVN_APR_INCLUDES@
SVN_APRUTIL_CONFIG = @SVN_APRUTIL_CONFIG@
@@ -196,6 +198,9 @@ COMPILE_JAVAHL_CXX = $(LIBTOOL) $(LTCXXF
COMPILE_JAVAHL_JAVAC = $(JAVAC) $(JAVAC_FLAGS)
COMPILE_JAVAHL_JAVAH = $(JAVAH)
+# special compilation for files destined for cxxhl
+COMPILE_CXXHL_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX)
$(LT_CFLAGS) $(CXXHL_INCLUDES) -o $@ -c
+
LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS)
$(LDFLAGS) -rpath $(libdir)
LINK_LIB = $(LINK) $(LT_SO_VERSION)
LINK_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS)
$(CXXFLAGS) $(LDFLAGS) -rpath $(libdir)
Modified: subversion/trunk/build.conf
URL:
http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1414728&r1=1414727&r2=1414728&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Wed Nov 28 14:39:42 2012
@@ -38,6 +38,8 @@ private-includes =
subversion/include/private/*.h
subversion/bindings/swig/include/*.swg
subversion/libsvn_delta/compose_delta.c
+ subversion/bindings/cxxhl/include/*.h
+ subversion/bindings/cxxhl/include/types/*.h
private-built-includes =
subversion/svn_private_config.h
subversion/libsvn_fs_fs/rep-cache-db.h
@@ -623,6 +625,22 @@ link-cmd = $(LINK_JAVAHL_CXX)
# ----------------------------------------------------------------------------
#
+# C++HL targets
+#
+
+[libsvncxxhl]
+description = Subversion C++ HighLevel binding
+type = lib
+path = subversion/bindings/cxxhl
+libs = libsvn_repos libsvn_client libsvn_wc libsvn_ra libsvn_delta libsvn_diff
+ libsvn_subr libsvn_fs aprutil apriconv apr
+sources = src/*.cpp src/types/*.cpp
+install = cxxhl-lib
+compile-cmd = $(COMPILE_CXXHL_CXX)
+link-cmd = $(LINK_CXX_LIB)
+
+# ----------------------------------------------------------------------------
+#
# TESTING TARGETS
#
Modified: subversion/trunk/build/generator/gen_make.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_make.py?rev=1414728&r1=1414727&r2=1414728&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_make.py (original)
+++ subversion/trunk/build/generator/gen_make.py Wed Nov 28 14:39:42 2012
@@ -423,8 +423,9 @@ class Generator(gen_base.GeneratorBase):
# certain areas require hooks for extra install rules defined
# in Makefile.in
### we should turn AREA into an object, then test it instead of this
- if area[:5] == 'swig-' and area[-4:] != '-lib' or \
- area[:7] == 'javahl-' \
+ if area[:5] == 'swig-' and area[-4:] != '-lib' \
+ or area[:7] == 'javahl-' \
+ or area[:6] == 'cxxhl-' \
or area == 'tools':
ezt_area.extra_install = 'yes'
Modified: subversion/trunk/configure.ac
URL:
http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1414728&r1=1414727&r2=1414728&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Wed Nov 28 14:39:42 2012
@@ -988,7 +988,7 @@ AS_HELP_STRING([--enable-maintainer-mode
dnl Enable some extra warnings. Put these before the user's flags
dnl so the user can specify flags that override these.
CFLAGS="-Wpointer-arith -Wwrite-strings -Wshadow -ansi -Wall
-Wformat=2 -Wunused -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wno-multichar -Wredundant-decls -Wnested-externs
-Wunreachable-code -Winline -Wno-long-long $CFLAGS"
- CXXFLAGS="-Wpointer-arith -Wwrite-strings -Wshadow $CXXFLAGS"
+ CXXFLAGS="-Wpointer-arith -Wwrite-strings -Wshadow -ansi -Wall
$CXXFLAGS"
dnl some additional flags that can be handy for an occasional review,
dnl but throw too many warnings in svn code, of too little importance,
@@ -996,7 +996,7 @@ AS_HELP_STRING([--enable-maintainer-mode
dnl switches enabled.
dnl CFLAGS="-Wswitch-enum -Wswitch-default $CFLAGS"
- dnl Add each of the following flags only if the compiler accepts it.
+ dnl Add each of the following flags only if the C compiler accepts it.
CFLAGS_KEEP="$CFLAGS"
AC_LANG_PUSH([C])
@@ -1026,6 +1026,23 @@ AS_HELP_STRING([--enable-maintainer-mode
AC_LANG_POP([C])
CFLAGS="$CFLAGS_KEEP"
+
+ dnl Add each of the following flags only if the C++ compiler accepts
it.
+
+ CXXFLAGS_KEEP="$CXXFLAGS"
+ AC_LANG_PUSH([C++])
+
+ CXXFLAGS="-Wextra-tokens $CXXFLAGS_KEEP"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CXXFLAGS_KEEP="$CXXFLAGS"])
+
+ CXXFLAGS="-Wshorten-64-to-32 $CXXFLAGS_KEEP"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CXXFLAGS_KEEP="$CXXFLAGS"])
+
+ CXXFLAGS="-Wno-system-headers $CXXFLAGS_KEEP"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CXXFLAGS_KEEP="$CXXFLAGS"])
+
+ AC_LANG_POP([C++])
+ CXXFLAGS="$CXXFLAGS_KEEP"
fi
fi
])
Added: subversion/trunk/subversion/bindings/cxxhl/README
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxxhl/README?rev=1414728&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/cxxhl/README (added)
+++ subversion/trunk/subversion/bindings/cxxhl/README Wed Nov 28 14:39:42 2012
@@ -0,0 +1,13 @@
+WORK IN PROGRESS
+================
+
+This directory contains an experimental implementation of a C++HL, a
+high-level Subversion C++ API, modeled along the lines of JavaHL.
+
+It is far from complete and may never see the light of day.
+
+On the other hand, one good reason for having a high-level C++ API is
+to use it as a baseline for Swig-generated binadings. Our current set
+of Perl, Python and Ruby bindings is too heterogenous in terms of
+feature set, object and usage model. They're almost as hard to use as
+the C API itself.
\ No newline at end of file
Added: subversion/trunk/subversion/bindings/cxxhl/include/svn_cxxhl_types.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxxhl/include/svn_cxxhl_types.h?rev=1414728&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/cxxhl/include/svn_cxxhl_types.h (added)
+++ subversion/trunk/subversion/bindings/cxxhl/include/svn_cxxhl_types.h Wed
Nov 28 14:39:42 2012
@@ -0,0 +1,33 @@
+/**
+ * @copyright
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ * @endcopyright
+ */
+
+#ifndef __cplusplus
+#error "This is a C++ header file."
+#endif
+
+#ifndef SVN_CXXHL_TYPES_H
+#define SVN_CXXHL_TYPES_H
+
+#include "types/svn_cxxhl_tristate.h"
+
+#endif // SVN_CXXHL_TYPES_H
Added:
subversion/trunk/subversion/bindings/cxxhl/include/types/svn_cxxhl_tristate.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxxhl/include/types/svn_cxxhl_tristate.h?rev=1414728&view=auto
==============================================================================
---
subversion/trunk/subversion/bindings/cxxhl/include/types/svn_cxxhl_tristate.h
(added)
+++
subversion/trunk/subversion/bindings/cxxhl/include/types/svn_cxxhl_tristate.h
Wed Nov 28 14:39:42 2012
@@ -0,0 +1,57 @@
+/* -*- C++ -*- */
+/**
+ * @copyright
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ * @endcopyright
+ */
+
+#ifndef __cplusplus
+#error "This is a C++ header file."
+#endif
+
+#ifndef SVN_CXXHL_TYPES_TRISTATE_H
+#define SVN_CXXHL_TYPES_TRISTATE_H
+
+namespace apache {
+namespace subversion {
+namespace cxxhl {
+
+class Tristate
+{
+ public:
+ Tristate(const Tristate& that) : m_value(that.m_value) {}
+
+ bool operator==(const Tristate& that) { return m_value == that.m_value; }
+ bool operator!=(const Tristate& that) { return !(*this == that); }
+
+ static const Tristate TRUE;
+ static const Tristate FALSE;
+ static const Tristate UNKNOWN;
+
+ private:
+ explicit Tristate(short value);
+ short m_value;
+};
+
+} // namespace cxxhl
+} // namespace subversion
+} // namespace apache
+
+#endif // SVN_CXXHL_TYPES_TRISTATE_H
Added: subversion/trunk/subversion/bindings/cxxhl/src/types/tristate.cpp
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxxhl/src/types/tristate.cpp?rev=1414728&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/cxxhl/src/types/tristate.cpp (added)
+++ subversion/trunk/subversion/bindings/cxxhl/src/types/tristate.cpp Wed Nov
28 14:39:42 2012
@@ -0,0 +1,42 @@
+/**
+ * @copyright
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ * @endcopyright
+ */
+
+#include "types/svn_cxxhl_tristate.h"
+
+#include "svn_types.h"
+#undef TRUE
+#undef FALSE
+
+namespace apache {
+namespace subversion {
+namespace cxxhl {
+
+Tristate::Tristate(short value) : m_value(value) {}
+
+const Tristate Tristate::TRUE(svn_tristate_true);
+const Tristate Tristate::FALSE(svn_tristate_false);
+const Tristate Tristate::UNKNOWN(svn_tristate_unknown);
+
+} // namespace cxxhl
+} // namespace subversion
+} // namespace apache