Skip to content

Commit

Permalink
Removed USE_STD_CXX_INLUDES.
Browse files Browse the repository at this point in the history
Removed macro USE_STD_CXX_INCLUDES which allowed (if turned off) to
include old C headers instead of using their respective counterpart coming
with C++ (e.g. use time.h and string.h instead of <ctime> and
<cstring>).

Using only the C++ version has been the hardcoded behaviour for CMake builds
anyway (for automake it has been configurable up to now).

All related build configuration tests and related code header guards/includes
for the C-style headers have been removed.
  • Loading branch information
michaelonken committed Feb 25, 2021
1 parent 1d98cfd commit 744a946
Show file tree
Hide file tree
Showing 290 changed files with 1,091 additions and 2,245 deletions.
33 changes: 10 additions & 23 deletions CMake/GenerateDCMTKConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@ else()
set(DCMTK_ENABLE_CHARSET_CONVERSION OFF)
endif()

# Standard C++ headers (currently hard-coded)
#if(VTK_USE_ANSI_STDLIB)
set(USE_STD_CXX_INCLUDES 1)
#else()
# set(USE_STD_CXX_INCLUDES "")
#endif()

# Configure file

# Windows being windows, it lies about its processor type to 32 bit binaries
Expand Down Expand Up @@ -636,11 +629,11 @@ endif()
CHECK_FUNCTIONWITHHEADER_EXISTS(setsockopt "${HEADERS}" HAVE_PROTOTYPE_SETSOCKOPT)
CHECK_FUNCTIONWITHHEADER_EXISTS(socket "${HEADERS}" HAVE_PROTOTYPE_SOCKET)
CHECK_FUNCTIONWITHHEADER_EXISTS(listen "${HEADERS}" HAVE_PROTOTYPE_LISTEN)
CHECK_FUNCTIONWITHHEADER_EXISTS(_vsnprintf_s "${HEADERS}" HAVE__VSNPRINTF_S)
CHECK_FUNCTIONWITHHEADER_EXISTS(vfprintf_s "${HEADERS}" HAVE_VFPRINTF_S)
CHECK_FUNCTIONWITHHEADER_EXISTS(vprintf "${HEADERS}" HAVE_VPRINTF)
CHECK_FUNCTIONWITHHEADER_EXISTS(vsnprintf "${HEADERS}" HAVE_VSNPRINTF)
CHECK_FUNCTIONWITHHEADER_EXISTS(vsprintf_s "${HEADERS}" HAVE_VSPRINTF_S)
CHECK_FUNCTIONWITHHEADER_EXISTS(_vsnprintf_s "${CXXHEADERS}" HAVE__VSNPRINTF_S)
CHECK_FUNCTIONWITHHEADER_EXISTS(vfprintf_s "${CXXHEADERS}" HAVE_VFPRINTF_S)
CHECK_FUNCTIONWITHHEADER_EXISTS(vprintf "${CXXHEADERS}" HAVE_VPRINTF)
CHECK_FUNCTIONWITHHEADER_EXISTS(vsnprintf "${CXXHEADERS}" HAVE_VSNPRINTF)
CHECK_FUNCTIONWITHHEADER_EXISTS(vsprintf_s "${CXXHEADERS}" HAVE_VSPRINTF_S)
CHECK_FUNCTIONWITHHEADER_EXISTS(std::vfprintf "${CXXHEADERS}" HAVE_PROTOTYPE_STD__VFPRINTF)
CHECK_FUNCTIONWITHHEADER_EXISTS(std::vsnprintf "${CXXHEADERS}" HAVE_PROTOTYPE_STD__VSNPRINTF)
CHECK_FUNCTIONWITHHEADER_EXISTS(_stricmp "${HEADERS}" HAVE_PROTOTYPE__STRICMP)
Expand Down Expand Up @@ -692,12 +685,12 @@ endif()
CHECK_FUNCTIONWITHHEADER_EXISTS("char16_t definition" "${HEADERS}" HAVE_CHAR16_T)

# File access stuff
CHECK_FUNCTIONWITHHEADER_EXISTS("fpos64_t definition" "${HEADERS}" HAVE_FPOS64_T)
CHECK_FUNCTIONWITHHEADER_EXISTS("off64_t definition" "${HEADERS}" HAVE_OFF64_T)
CHECK_FUNCTIONWITHHEADER_EXISTS("fpos64_t definition" "${CXXHEADERS}" HAVE_FPOS64_T)
CHECK_FUNCTIONWITHHEADER_EXISTS("off64_t definition" "${CXXHEADERS}" HAVE_OFF64_T)
# Check if the POSIX functions are available (even on Windows). They are preferred
# to the Microsoft specific functions on compilers like MinGW.
CHECK_FUNCTIONWITHHEADER_EXISTS("popen" "${HEADERS}" HAVE_POPEN)
CHECK_FUNCTIONWITHHEADER_EXISTS("pclose" "${HEADERS}" HAVE_PCLOSE)
CHECK_FUNCTIONWITHHEADER_EXISTS("popen" "${CXXHEADERS}" HAVE_POPEN)
CHECK_FUNCTIONWITHHEADER_EXISTS("pclose" "${CXXHEADERS}" HAVE_PCLOSE)

# Signal handling functions
CHECK_FUNCTIONWITHHEADER_EXISTS("sigjmp_buf definition" "setjmp.h" HAVE_SIGJMP_BUF)
Expand Down Expand Up @@ -967,13 +960,7 @@ function(DCMTK_CHECK_ENABLE_LFS)
message(STATUS "${MESSAGE}")
# determine size of fpos_t (for the strange LFS implementation on Windows)
set(CMAKE_EXTRA_INCLUDE_FILES)
if(HAVE_STDIO_H)
# prefer stdio.h so that is not in namespace std
set(CMAKE_EXTRA_INCLUDE_FILES "stdio.h")
elseif(HAVE_CSTDIO)
# use cstdio as the fallback
set(CMAKE_EXTRA_INCLUDE_FILES "cstdio")
endif()
set(CMAKE_EXTRA_INCLUDE_FILES "cstdio")
CHECK_TYPE_SIZE("fpos_t" SIZEOF_FPOS_T)
# assume sizeof off_t to be correct, will be removed if below tests fail
set(SIZEOF_OFF_T 8)
Expand Down
3 changes: 0 additions & 3 deletions CMake/osconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -909,9 +909,6 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */

/* Define if ANSI standard C++ includes are used */
#cmakedefine USE_STD_CXX_INCLUDES

/* Define if we are compiling with libiconv support. */
#cmakedefine WITH_LIBICONV

Expand Down
8 changes: 0 additions & 8 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -663,14 +663,6 @@ Known limitations of DCMTK on the Windows platform.

1. The dcmqrscp tool cannot spark multiple processes. Every association must
be handled completely before a new association is possible.
2. Visual C++ contains two different implementations of I/O streams which
should never be mixed within one application because this may cause
application errors that are hard to find. The old, now deprecated
implementation uses the traditional cfront header files <iostream.h> etc.
The new implementation uses <iostream> etc. as defined in ANSI/ISO C++.
DCMTK can be configured to use either of the two interfaces. This behavior
can be changed in "config/include/dcmtk/config/osconfig.h" in the build
directory where the symbol USE_STD_CXX_INCLUDES is declared.


Unix with CMake
Expand Down
4 changes: 0 additions & 4 deletions config/aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1644,11 +1644,7 @@ AC_DEFUN([AC_STDIO_NAMESPACE],
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
#ifdef USE_STD_CXX_INCLUDES
#include <cstdio>
#else
#include <stdio.h>
#endif
],[FILE *f = ::fopen("name", "r");],
ac_cv_stdio_namespace_is_std=no, ac_cv_stdio_namespace_is_std=yes)
AC_LANG_RESTORE
Expand Down
161 changes: 80 additions & 81 deletions config/configure
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@ enable_option_checking
enable_debug
enable_threads
enable_lfs
enable_std_includes
enable_private_tags
enable_external_dict
enable_builtin_dict
Expand Down Expand Up @@ -1404,8 +1403,6 @@ Optional Features:
--disable-threads compile without MT support
--enable-lfs=TYPE compile with LFS support (lfs/lfs64/auto=default)
--disable-lfs compile without LFS support
--enable-std-includes use C++ ANSI standard includes (default: auto)
--disable-std-includes use old C++ includes
--enable-private-tags enable private tag dictionary
--disable-private-tags don't enable private tag dictionary (default)
--enable-external-dict enable loading of external dictionary (default)
Expand Down Expand Up @@ -13012,68 +13009,15 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use C++ standard includes" >&5
$as_echo_n "checking whether to use C++ standard includes... " >&6; }
ac_use_std_includes="auto"
# Check whether --enable-std-includes was given.
if test "${enable_std_includes+set}" = set; then :
enableval=$enable_std_includes; case "$enableval" in
yes)
ac_use_std_includes="yes"
;;
*)
ac_use_std_includes="no"
;;
esac
fi
if test "$ac_cv_header_fstream" = "yes" -a "$ac_cv_header_iostream" = "yes" -a "$ac_cv_header_iomanip" = "yes"; then
ac_have_std_includes="yes"
else
ac_have_std_includes="no"
fi
if test "$ac_cv_header_fstream_h" = "yes" -a "$ac_cv_header_iostream_h" = "yes" -a "$ac_cv_header_iomanip_h" = "yes"; then
ac_have_old_includes="yes"
else
ac_have_old_includes="no"
fi
if test "$ac_use_std_includes" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define USE_STD_CXX_INCLUDES /**/" >>confdefs.h
elif test "$ac_use_std_includes" = "no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
elif test "$ac_have_std_includes" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define USE_STD_CXX_INCLUDES /**/" >>confdefs.h
ac_use_std_includes="yes"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
ac_use_std_includes="no"
fi
if test "$ac_use_std_includes" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ standard namespace" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ standard namespace" >&5
$as_echo_n "checking for C++ standard namespace... " >&6; }
if ${ac_cv_check_std_namespace+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_link_o='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.o $LIBS 1>&5'
cat > conftest.$ac_ext <<EOF
#line 13076 "configure"
#line 13020 "configure"
#include "confdefs.h"
#include <iostream>
Expand Down Expand Up @@ -13233,7 +13177,7 @@ $as_echo "no" >&6; }
fi
unset ac_cv_declaration
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::vfprintf (in cstdarg cstdio)" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::vfprintf (in cstdarg cstdio)" >&5
$as_echo_n "checking for std::vfprintf (in cstdarg cstdio)... " >&6; }
ac_includes=""
Expand Down Expand Up @@ -13281,7 +13225,7 @@ else
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::vsnprintf (in cstdarg cstdio)" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::vsnprintf (in cstdarg cstdio)" >&5
$as_echo_n "checking for std::vsnprintf (in cstdarg cstdio)... " >&6; }
ac_includes=""
Expand Down Expand Up @@ -13329,15 +13273,75 @@ else
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ standard namespace" >&5
$as_echo_n "checking for C++ standard namespace... " >&6; }
if ${ac_cv_check_std_namespace+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_link_o='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.o $LIBS 1>&5'
cat > conftest.$ac_ext <<EOF
#line 13286 "configure"
#include "confdefs.h"
#include <iostream>
using namespace std;
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking declaration for std::ios_base::openmode (in iostream.h)" >&5
$as_echo_n "checking declaration for std::ios_base::openmode (in iostream.h)... " >&6; }
int main() {
cout << "Hello World" << endl;
; return 0; }
EOF
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link_o\""; } >&5
(eval $ac_link_o) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
rm -rf conftest*
eval "ac_cv_check_std_namespace=yes"
else
echo "configure: failed link was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_check_std_namespace=no"
fi
else
echo "configure: failed compile was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_check_std_namespace=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_check_std_namespace'`\" = yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ac_tr_std_namespace=HAVE_STD_NAMESPACE
cat >>confdefs.h <<_ACEOF
#define $ac_tr_std_namespace 1
_ACEOF
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking declaration for std::ios_base::openmode (in iostream)" >&5
$as_echo_n "checking declaration for std::ios_base::openmode (in iostream)... " >&6; }
ac_includes=""
ac_cpp_includes=""
for ac_header in iostream.h
for ac_header in iostream
do
ac_safe=`echo "$ac_header" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'}'`\" = yes"; then
Expand Down Expand Up @@ -13395,8 +13399,8 @@ fi
unset ac_cv_declaration
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking declaration of ios::nocreate (in fstream.h)" >&5
$as_echo_n "checking declaration of ios::nocreate (in fstream.h)... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking declaration of ios::nocreate (in fstream)" >&5
$as_echo_n "checking declaration of ios::nocreate (in fstream)... " >&6; }
ac_cv_declaration=ac_cv_declaration_ios_nocreate
if eval \${$ac_cv_declaration+:} false; then :
Expand All @@ -13405,14 +13409,14 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <fstream.h>
#include <fstream>
int
main ()
{
namespace std { }
using namespace std;
ifstream file("name", ios::nocreate)
ifstream file("name", std::ios::nocreate)
;
return 0;
}
Expand All @@ -13439,11 +13443,11 @@ $as_echo "no" >&6; }
fi
unset ac_cv_declaration
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::vfprintf (in stdarg.h stdio.h)" >&5
$as_echo_n "checking for std::vfprintf (in stdarg.h stdio.h)... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::vfprintf (in cstdarg cstdio)" >&5
$as_echo_n "checking for std::vfprintf (in cstdarg cstdio)... " >&6; }
ac_includes=""
for ac_header in stdarg.h stdio.h
for ac_header in cstdarg cstdio
do
ac_safe=`echo "$ac_header" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'}'`\" = yes"; then
Expand Down Expand Up @@ -13487,11 +13491,11 @@ else
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::vsnprintf (in stdarg.h stdio.h)" >&5
$as_echo_n "checking for std::vsnprintf (in stdarg.h stdio.h)... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::vsnprintf (in cstdarg cstdio)" >&5
$as_echo_n "checking for std::vsnprintf (in cstdarg cstdio)... " >&6; }
ac_includes=""
for ac_header in stdarg.h stdio.h
for ac_header in cstdarg cstdio
do
ac_safe=`echo "$ac_header" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'}'`\" = yes"; then
Expand Down Expand Up @@ -13535,7 +13539,6 @@ else
$as_echo "no" >&6; }
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ class template" >&5
$as_echo_n "checking for C++ class template... " >&6; }
Expand All @@ -13545,7 +13548,7 @@ if ${ac_cv_check_class_template+:} false; then :
else
ac_link_o='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.o $LIBS 1>&5'
cat > conftest.$ac_ext <<EOF
#line 13548 "configure"
#line 13551 "configure"
#include "confdefs.h"
template <class T>
Expand Down Expand Up @@ -13617,7 +13620,7 @@ if ${ac_cv_check_static_template_method+:} false; then :
else
ac_link_o='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.o $LIBS 1>&5'
cat > conftest.$ac_ext <<EOF
#line 13620 "configure"
#line 13623 "configure"
#include "confdefs.h"
void additive(int & i)
Expand Down Expand Up @@ -13689,7 +13692,7 @@ if ${ac_cv_check_function_template+:} false; then :
else
ac_link_o='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.o $LIBS 1>&5'
cat > conftest.$ac_ext <<EOF
#line 13692 "configure"
#line 13695 "configure"
#include "confdefs.h"
template <class T>
Expand Down Expand Up @@ -13896,11 +13899,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef USE_STD_CXX_INCLUDES
#include <cstdio>
#else
#include <stdio.h>
#endif
int
main ()
Expand Down
Loading

0 comments on commit 744a946

Please sign in to comment.