fprintf/vfprintf dependency fix
authorDavid Flamme <david.flamme@gmx.net>
Tue, 15 Feb 2011 21:40:18 +0000 (22:40 +0100)
committerDavid Flamme <david.flamme@gmx.net>
Tue, 15 Feb 2011 21:40:18 +0000 (22:40 +0100)
* src/vm/os.hpp: Added vfprintf wrapper
                 removed fprintf wrapper, but kept the availability check
* configure.ac: Added vfprintf linker check
* src/toolbox/logging.cpp: using os::vfprintf
* src/vm/vm.cpp: version

Due to a compatibility check of clang 2.7, the decision was made to define that fprintf is mandatory for cacao

configure.ac
src/toolbox/logging.cpp
src/vm/os.hpp
src/vm/vm.cpp

index 81da789f9667b0d4f166e23cac623bd2130921b3..1eec8efcf93c6a6adf825cf7afe6c8a9c90fa1d3 100644 (file)
@@ -341,6 +341,7 @@ AC_CHECK_FUNCS([fclose])
 AC_CHECK_FUNCS([fflush])
 AC_CHECK_FUNCS([fopen])
 AC_CHECK_FUNCS([fprintf])
+AC_CHECK_FUNCS([vfprintf])
 AC_CHECK_FUNCS([fread])
 AC_CHECK_FUNCS([free])
 AC_CHECK_FUNCS([fstat])
index c38b32b02ef4e3f47a5cc31a90c19742f75cb866..1a05754943a68a6d89c208f0f5c04e318f36cd6a 100644 (file)
@@ -109,9 +109,9 @@ void log_start(void)
 void log_vprint(const char *text, va_list ap)
 {
        if (logfile)
-               vfprintf(logfile, text, ap);
+               os::vfprintf(logfile, text, ap);
        else
-               vfprintf(stdout, text, ap);
+               os::vfprintf(stdout, text, ap);
 }
 
 
index 752b76364ad621a5eceb5a70f1e2ee6c0a52aa9a..59e4da54cf09b0b466a3e9a287f45ad84146348f 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/os.hpp - system (OS) functions
 
-   Copyright (C) 2007, 2008, 2009, 2010
+   Copyright (C) 2007, 2008, 2009, 2010, 2011
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
    Copyright (C) 2008 Theobroma Systems Ltd.
 
@@ -144,7 +144,7 @@ public:
        static inline void*   dlsym(void* handle, const char* symbol);
        static inline int     fclose(FILE* fp);
        static inline FILE*   fopen(const char* path, const char* mode);
-       static inline int     fprintf(FILE* stream, const char* format, ...);
+       static inline int     vfprintf ( FILE * stream, const char * format, va_list arg );
        static inline size_t  fread(void* ptr, size_t size, size_t nmemb, FILE* stream);
        static inline void    free(void* ptr);
        static inline char*   getcwd(char* buf, size_t size);
@@ -342,16 +342,18 @@ inline FILE* os::fopen(const char* path, const char* mode)
 #endif
 }
 
-inline int os::fprintf(FILE* stream, const char* format, ...)
+//fprintf is mandatory and can't be replaced with an equivalent fast wrapper
+#if !defined (HAVE_FPRINTF) 
+#error fprintf not available
+#endif
+
+inline int os::vfprintf ( FILE * stream, const char * format, va_list arg )
 {
-#if defined(HAVE_FPRINTF)
-       va_list ap;
-       va_start(ap, format);
-       int result = ::vfprintf(stream, format, ap);
-       va_end(ap);
+#if defined(HAVE_VFPRINTF)
+       int result = ::vfprintf(stream, format, arg);
        return result;
 #else
-# error fprintf not available
+# error vfrpintf not available
 #endif
 }
 
index a4be50fa56d2195adb898d66356a92e1ce1ad35f..ef1e93dbcdba2d659f596b7ee0872a423f06820c 100644 (file)
@@ -542,7 +542,7 @@ static void version(bool opt_exit)
        puts("java version \""JAVA_VERSION"\"");
        puts("CACAO version "VERSION_FULL"\n");
 
-       puts("Copyright (C) 1996-2005, 2006, 2007, 2008, 2009, 2010");
+       puts("Copyright (C) 1996-2005, 2006, 2007, 2008, 2009, 2010, 2011");
        puts("CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO");
        puts("This is free software; see the source for copying conditions.  There is NO");
        puts("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");