Author: cfinck
Date: Sat Jul 5 09:37:46 2008
New Revision: 34306
URL:
http://svn.reactos.org/svn/reactos?rev=34306&view=rev
Log:
- Get our Win32 version of ccache to compile warning-free under MSVC (tested with 2008 at
/W4) and GCC (tested with RosBE-Windows 1.2 at -Wall -pedantic)
- Fix the MSVC project file
- Add a Makefile for compiling with mingw32-gcc
Added:
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/Makefile
Modified:
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ (props changed)
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.c
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/config.h
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.c
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/snprintf.c
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/util.c
trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.c
Propchange: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jul 5 09:37:46 2008
@@ -1,0 +1,7 @@
+*.exe
+*.user
+*.ncb
+*.suo
+*.sln
+Debug
+Release
Added: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/Makefile
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/Makefile (added)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/Makefile [iso-8859-1] Sat Jul 5
09:37:46 2008
@@ -1,0 +1,24 @@
+# mingw32 makefile for ccache
+
+TARGET := ccache.exe
+
+.PHONY: all
+
+all: $(TARGET)
+
+CC=gcc
+CFLAGS := -Wall -pedantic -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0400 -O2
+LFLAGS := -s
+SRCS := args.c ccache.c cleanup.c execute.c getopt.c hash.c mdfour.c snprintf.c stats.c
unify.c util.c win32-dirent.c
+OBJS := $(SRCS:.c=.o)
+
+$(TARGET): $(OBJS)
+ $(CC) $(LFLAGS) -o $@ $(OBJS)
+
+.c.o: $<
+ $(CC) $(CFLAGS) -c $< -o $@
+
+.PHONY: clean
+clean:
+ -@del $(TARGET)
+ -@del $(OBJS)
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj [iso-8859-1]
(original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj [iso-8859-1] Sat
Jul 5 09:37:46 2008
@@ -17,7 +17,7 @@
<Configurations>
<Configuration
Name="Debug|Win32"
- OutputDirectory="."
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
@@ -45,8 +45,8 @@
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
@@ -84,15 +84,12 @@
Name="VCAppVerifierTool"
/>
<Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
- OutputDirectory="C:\RosBE\4.1.3\bin"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
@@ -115,11 +112,11 @@
/>
<Tool
Name="VCCLCompilerTool"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
@@ -157,9 +154,6 @@
/>
<Tool
Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
@@ -203,10 +197,6 @@
</File>
<File
- RelativePath=".\mkstemps.c"
- >
- </File>
- <File
RelativePath=".\snprintf.c"
</File>
@@ -253,12 +243,6 @@
</File>
</Filter>
- <Filter
- Name="Ressourcendateien"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
</Files>
<Globals>
</Globals>
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.c [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.c [iso-8859-1] Sat Jul 5
09:37:46 2008
@@ -126,7 +126,7 @@
{
char *e;
#ifdef _WIN32
- STARTUPINFO si;
+ STARTUPINFOA si;
PROCESS_INFORMATION pi;
char* merged = build_command(orig_args->argv);
#endif
@@ -150,7 +150,7 @@
/* strip any local args */
args_strip(orig_args, "--ccache-");
- if ((e=getenv("CCACHE_PREFIX"))) {
+ if ((e=getenv("CCACHE_PREFIX")) != NULL) {
char *p = find_executable(e, MYNAME);
if (!p) {
perror(e);
@@ -160,10 +160,10 @@
}
#ifdef _WIN32
- ZeroMemory(&si, sizeof(STARTUPINFO));
+ ZeroMemory(&si, sizeof(STARTUPINFOA));
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
- si.cb = sizeof(STARTUPINFO);
+ si.cb = sizeof(STARTUPINFOA);
if(!CreateProcessA(orig_args->argv[0], merged, NULL, NULL, FALSE, 0, NULL, NULL,
&si, &pi))
{
@@ -334,7 +334,7 @@
char *input_base;
char *tmp;
- if ((s = getenv("CCACHE_NLEVELS"))) {
+ if ((s = getenv("CCACHE_NLEVELS")) != NULL) {
nlevels = atoi(s);
if (nlevels < 1) nlevels = 1;
if (nlevels > 8) nlevels = 8;
@@ -646,7 +646,7 @@
}
/* support user override of the compiler */
- if ((path=getenv("CCACHE_CC"))) {
+ if ((path=getenv("CCACHE_CC")) != NULL) {
base = strdup(path);
}
@@ -874,7 +874,7 @@
if (!output_file) {
char *p;
output_file = x_strdup(input_file);
- if ((p = strrchr(output_file, PATH_SEP_CHAR))) {
+ if ((p = strrchr(output_file, PATH_SEP_CHAR)) != NULL) {
output_file = p+1;
}
p = strrchr(output_file, '.');
@@ -894,7 +894,7 @@
failed();
}
- if ((e=getenv("CCACHE_PREFIX"))) {
+ if ((e=getenv("CCACHE_PREFIX")) != NULL) {
char *p = find_executable(e, MYNAME);
if (!p) {
perror(e);
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h [iso-8859-1] Sat Jul 5
09:37:46 2008
@@ -44,7 +44,11 @@
#define link(filename, linkname) CreateHardLinkA(linkname, filename, NULL)
#define PROT_READ 0x0001
#define MAP_PRIVATE 0x02
- typedef int mode_t;
+
+ #ifdef _MSC_VER
+ typedef unsigned int mode_t;
+ #endif
+
#ifndef S_ISREG
#define S_ISREG(m) ((m & _S_IFREG) == _S_IFREG)
#endif
@@ -62,7 +66,10 @@
#define PATH_SEP USUAL_PATH_SEP
#define PATH_SEP_CHAR USUAL_PATH_SEP_CHAR
#define DEV_NULL "/dev/null"
-#endif
+
+ char *x_realpath(const char *path);
+#endif
+
#include <fcntl.h>
#include <time.h>
#include <string.h>
@@ -142,7 +149,6 @@
int lock_fd(int fd);
size_t file_size(struct stat *st);
int safe_open(const char *fname);
-char *x_realpath(const char *path);
char *gnu_getcwd(void);
int create_empty_file(const char *fname);
const char *get_home_directory(void);
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/config.h
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/config.h [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/config.h [iso-8859-1] Sat Jul 5
09:37:46 2008
@@ -1,4 +1,3 @@
-
#define HAVE_STRING_H
#define HAVE_STDLIB_H
-#define HAVE_CTYPE_H
+#define HAVE_CTYPE_H
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/execute.c [iso-8859-1] Sat Jul 5
09:37:46 2008
@@ -92,7 +92,7 @@
_close(fd);
/* Spawn process (_exec* familly doesn't return) */
- status = _spawnv(_P_WAIT, argv[0], argv);
+ status = _spawnv(_P_WAIT, argv[0], (const char* const*)argv);
out:
cc_log("%s:\n stdout -> %s\n stderr -> %s\n process status=%i\n",
@@ -115,7 +115,13 @@
*/
char is_exec_file(const char *fname, const char *exclude_name)
{
- struct stat st1, st2;
+ struct stat st2;
+
+#ifdef _WIN32
+ UNREFERENCED_PARAMETER(exclude_name);
+#else
+ struct stat st1;
+#endif
if (access(fname, 0) == 0 &&
#ifndef _WIN32 /* Symlinks not used under windows */
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.c [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.c [iso-8859-1] Sat Jul 5
09:37:46 2008
@@ -74,7 +74,7 @@
}
} /* option letter okay? */
if ((optopt = (int)*place++) == (int)':' ||
- !(oli = strchr(ostr, optopt))) {
+ (oli = strchr(ostr, optopt)) == NULL) {
/*
* if the user didn't specify '-' as an option,
* assume it means EOF.
@@ -84,7 +84,7 @@
if (!*place)
++optind;
if (opterr) {
- if (!(p = strrchr(*nargv, '/')))
+ if ((p = strrchr(*nargv, '/')) == NULL)
p = *nargv;
else
++p;
@@ -103,7 +103,7 @@
optarg = place;
else if (nargc <= ++optind) { /* no arg */
place = EMSG;
- if (!(p = strrchr(*nargv, '/')))
+ if ((p = strrchr(*nargv, '/')) == NULL)
p = *nargv;
else
++p;
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/snprintf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/snprintf.c [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/snprintf.c [iso-8859-1] Sat Jul 5
09:37:46 2008
@@ -329,7 +329,7 @@
fvalue = va_arg (args, double);
break;
case 'c':
- dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
+ dopr_outch (buffer, &currlen, maxlen, (char)va_arg (args, int));
break;
case 's':
strvalue = va_arg (args, char *);
@@ -348,7 +348,7 @@
if (cflags == DP_C_SHORT) {
short int *num;
num = va_arg (args, short int *);
- *num = currlen;
+ *num = (short)currlen;
} else if (cflags == DP_C_LONG) {
long int *num;
num = va_arg (args, long int *);
@@ -437,7 +437,7 @@
static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
long value, int base, int min, int max, int flags)
{
- int signvalue = 0;
+ char signvalue = 0;
unsigned long uvalue;
char convert[20];
int place = 0;
@@ -496,7 +496,7 @@
}
/* Sign */
- if (signvalue)
+ if (signvalue)
dopr_outch (buffer, currlen, maxlen, signvalue);
/* Zeros */
@@ -556,7 +556,7 @@
static double my_modf(double x0, double *iptr)
{
int i;
- long l;
+ long l = 0;
double x = x0;
double f = 1.0;
@@ -590,7 +590,7 @@
static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
LDOUBLE fvalue, int min, int max, int flags)
{
- int signvalue = 0;
+ char signvalue = 0;
double ufvalue;
char iconvert[311];
char fconvert[311];
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/util.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/util.c [iso-8859-1] (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/util.c [iso-8859-1] Sat Jul 5
09:37:46 2008
@@ -21,10 +21,7 @@
static FILE *logfile;
#ifdef _WIN32
-int fchmod(int fildes, mode_t mode)
-{
- return 0;
-}
+#define fchmod(a, b)
#endif
#ifndef HAVE_MKSTEMP
@@ -255,7 +252,7 @@
d = opendir(dir);
if (!d) return;
- while ((de = readdir(d))) {
+ while ((de = readdir(d)) != 0) {
char *fname;
struct stat st;
@@ -450,7 +447,7 @@
{
unsigned size = 128;
- while (1) {
+ for(;;) {
char *buffer = (char *)x_malloc(size);
if (_getcwd(buffer, size) == buffer) {
return buffer;
@@ -486,7 +483,7 @@
#ifdef _WIN32
static char szPath[MAX_PATH];
- // "Documents and Settings\user\Application Data" is CSIDL_APPDATA
+ /* "Documents and Settings\user\Application Data" is CSIDL_APPDATA */
if(SHGetSpecialFolderPathA(NULL, szPath, CSIDL_PROFILE, FALSE))
{
return szPath;
Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/cc…
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.c [iso-8859-1]
(original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.c [iso-8859-1] Sat Jul
5 09:37:46 2008
@@ -73,7 +73,7 @@
entry.d_off = dir->filepos;
strncpy (entry.d_name, find->cFileName, sizeof (entry.d_name));
- entry.d_reclen = strlen (find->cFileName);
+ entry.d_reclen = (unsigned short)strlen (find->cFileName);
dir->filepos++;
return &entry;
}