From: Date: Fri, 24 Feb 2012 07:28:50 +0000 (+0000) Subject: Add --disable-rtti X-Git-Tag: submit/tizen/20180313.064233~127 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=475ec9b9c41c891b102670013db3052bd784a5fc;p=platform%2Fupstream%2Fglog.git Add --disable-rtti git-svn-id: https://google-glog.googlecode.com/svn/trunk@109 eb4d4688-79bd-11dd-afb4-1d65580434c0 --- diff --git a/Makefile.am b/Makefile.am index 6ef6c2b..e32bc6a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,6 +25,10 @@ else endif endif +if DISABLE_RTTI + AM_CXXFLAGS += -fno-rtti +endif + glogincludedir = $(includedir)/glog ## The .h files you want to install (that is, .h files that people ## who install this package can include in their own applications.) diff --git a/Makefile.in b/Makefile.in index 731e82f..2986747 100644 --- a/Makefile.in +++ b/Makefile.in @@ -45,11 +45,12 @@ host_triplet = @host@ # These are x86-specific, having to do with frame-pointers @ENABLE_FRAME_POINTERS_TRUE@@X86_64_TRUE@am__append_2 = -fno-omit-frame-pointer @ENABLE_FRAME_POINTERS_FALSE@@X86_64_TRUE@am__append_3 = -DNO_FRAME_POINTER +@DISABLE_RTTI_TRUE@am__append_4 = -fno-rtti TESTS = logging_unittest$(EXEEXT) demangle_unittest$(EXEEXT) \ stacktrace_unittest$(EXEEXT) symbolize_unittest$(EXEEXT) \ stl_logging_unittest$(EXEEXT) utilities_unittest$(EXEEXT) \ $(am__EXEEXT_1) -@HAVE_GMOCK_TRUE@am__append_4 = mock_log_test +@HAVE_GMOCK_TRUE@am__append_5 = mock_log_test noinst_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_3) subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ @@ -471,7 +472,8 @@ ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = -I$(top_srcdir)/src # This is mostly based on configure options -AM_CXXFLAGS = $(am__append_1) $(am__append_2) $(am__append_3) +AM_CXXFLAGS = $(am__append_1) $(am__append_2) $(am__append_3) \ + $(am__append_4) glogincludedir = $(includedir)/glog gloginclude_HEADERS = src/glog/log_severity.h nodist_gloginclude_HEADERS = src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h diff --git a/configure b/configure index 48c0b81..38c5aeb 100755 --- a/configure +++ b/configure @@ -777,6 +777,8 @@ PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC acx_pthread_config +DISABLE_RTTI_FALSE +DISABLE_RTTI_TRUE X86_64_FALSE X86_64_TRUE ENABLE_FRAME_POINTERS_FALSE @@ -907,6 +909,7 @@ enable_fast_install with_gnu_ld enable_libtool_lock enable_frame_pointers +enable_rtti with_gflags enable_namespace ' @@ -1551,6 +1554,7 @@ Optional Features: --disable-libtool-lock avoid locking (might break parallel builds) --enable-frame-pointers On x86_64 systems, compile with -fno-omit-frame-pointer (see INSTALL) + --disable-rtti Disable RTTI in glog --enable-namespace=FOO to define these Google classes in the FOO namespace. --disable-namespace to define them in the global namespace. Default @@ -5529,13 +5533,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5532: $ac_compile\"" >&5) + (eval echo "\"\$as_me:5536: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:5535: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:5539: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:5538: output\"" >&5) + (eval echo "\"\$as_me:5542: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -6741,7 +6745,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6744 "configure"' > conftest.$ac_ext + echo '#line 6748 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8661,11 +8665,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8664: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8668: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8668: \$? = $ac_status" >&5 + echo "$as_me:8672: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9000,11 +9004,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9003: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9007: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9007: \$? = $ac_status" >&5 + echo "$as_me:9011: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9105,11 +9109,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9108: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9112: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9112: \$? = $ac_status" >&5 + echo "$as_me:9116: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9160,11 +9164,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9163: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9167: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9167: \$? = $ac_status" >&5 + echo "$as_me:9171: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11544,7 +11548,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11547 "configure" +#line 11551 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11640,7 +11644,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11643 "configure" +#line 11647 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13596,11 +13600,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13599: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13603: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13603: \$? = $ac_status" >&5 + echo "$as_me:13607: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13695,11 +13699,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13698: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13702: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13702: \$? = $ac_status" >&5 + echo "$as_me:13706: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13747,11 +13751,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13750: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13754: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13754: \$? = $ac_status" >&5 + echo "$as_me:13758: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15243,6 +15247,25 @@ else fi +# Check whether --enable-rtti was given. +if test "${enable_rtti+set}" = set; then : + enableval=$enable_rtti; +fi + + if test x"$enable_rtti" = x"no"; then + DISABLE_RTTI_TRUE= + DISABLE_RTTI_FALSE='#' +else + DISABLE_RTTI_TRUE='#' + DISABLE_RTTI_FALSE= +fi + +if test x"$enable_rtti" = x"no"; then + +$as_echo "#define DISABLE_RTTI 1" >>confdefs.h + +fi + # Some of the code in this directory depends on pthreads @@ -16586,6 +16609,10 @@ if test -z "${X86_64_TRUE}" && test -z "${X86_64_FALSE}"; then as_fn_error "conditional \"X86_64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${DISABLE_RTTI_TRUE}" && test -z "${DISABLE_RTTI_FALSE}"; then + as_fn_error "conditional \"DISABLE_RTTI\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_GMOCK_TRUE}" && test -z "${HAVE_GMOCK_FALSE}"; then as_fn_error "conditional \"HAVE_GMOCK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 4f5dc95..c2774c1 100644 --- a/configure.ac +++ b/configure.ac @@ -93,6 +93,14 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __x86_64__ == 1 ? 0 : 1])], AM_CONDITIONAL(ENABLE_FRAME_POINTERS, test "$enable_frame_pointers" = yes) AM_CONDITIONAL(X86_64, test "$is_x86_64" = yes) +AC_ARG_ENABLE(rtti, + AS_HELP_STRING([--disable-rtti], + [Disable RTTI in glog])) +AM_CONDITIONAL(DISABLE_RTTI, test x"$enable_rtti" = x"no") +if test x"$enable_rtti" = x"no"; then + AC_DEFINE(DISABLE_RTTI, 1, [define if glog doesn't use RTTI]) +fi + # Some of the code in this directory depends on pthreads ACX_PTHREAD if test x"$acx_pthread_ok" = x"yes"; then diff --git a/src/config.h.in b/src/config.h.in index 844a7fc..0115875 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -1,5 +1,8 @@ /* src/config.h.in. Generated from configure.ac by autoheader. */ +/* define if glog doesn't use RTTI */ +#undef DISABLE_RTTI + /* Namespace for Google classes */ #undef GOOGLE_NAMESPACE diff --git a/src/logging.cc b/src/logging.cc index b3b7703..3efcdf2 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -1365,8 +1365,13 @@ int64 LogMessage::num_messages(int severity) { // Output the COUNTER value. This is only valid if ostream is a // LogStream. ostream& operator<<(ostream &os, const PRIVATE_Counter&) { +#ifdef DISABLE_RTTI + LogMessage::LogStream *log = static_cast(&os); +#else LogMessage::LogStream *log = dynamic_cast(&os); - CHECK(log == log->self()); +#endif + CHECK(log && log == log->self()) + << "You must not use COUNTER with non-glog ostream"; os << log->ctr(); return os; }