[ccache] gcc options: -imacros and -include
ccache: version 2.2 OS: Windows XP Professional cygwin: latest version Hello, one question: what's about the compiler options -imacros and -include - are they include in generating the command line hash? Another question - I know it is off topic - is the file of the option -include included in the preprocessed output? I think it is! And the same with -imacros - I think not! Mit freundlichen Gruessen best regards Heiko Elger ARBURG GmbH + Co Heiko Elger - Softwareentwicklung - / - Research and Development - Arthur-Hehl-Strasse D-72290 Lossburg Tel.: +49 (0) 7446 33-3659 Fax.: +49 (0) 7446 33-3365 mailto:heiko_elgernos...@arburg.com http://www.arburg.com Bitte entfernen Sie "NOSPAM" von der Email-Adresse Please remove "NOSPAM" from the email address
[ccache] preprocessing with -P
> >> Maybe a better solution would be to remove lines with # when generating > >> the hash, but to keep them when compiling > > Yes - I think that is possible. > If it works - it would be a nice feature for us too. Try this...It's a quick hack, but it seems to work for me... Ciao again, Giulio cvs server: Diffing . Index: hash.c === RCS file: /cvsroot/ccache/hash.c,v retrieving revision 1.9 diff -u -r1.9 hash.c --- hash.c 29 Apr 2002 09:12:40 - 1.9 +++ hash.c 3 Dec 2003 15:59:20 - @@ -20,6 +20,8 @@ */ #include "ccache.h" +#include +#include static struct mdfour md; @@ -43,13 +45,25 @@ hash_buffer((char *)&x, sizeof(x)); } + /* add contents of a file to the hash */ void hash_file(const char *fname) { char buf[1024]; int fd, n; - fd = open(fname, O_RDONLY); + static const char *cmd1 = "/bin/cat <"; + static const char *cmd2 = "|/bin/grep -v \"^#\""; + static char cmd[4096]; + + cmd[0] = 0; + strcat(cmd, cmd1); + strcat(cmd, fname); + strcat(cmd, cmd2); + + FILE *file = popen(cmd, "r"); + fd = fileno(file); + if (fd == -1) { cc_log("Failed to open %s\n", fname); fatal("hash_file"); @@ -58,7 +72,8 @@ while ((n = read(fd, buf, sizeof(buf))) > 0) { hash_buffer(buf, n); } - close(fd); + + pclose(file); } /* return the hash result as a static string */ cvs server: Diffing packaging cvs server: Diffing web
[ccache] preprocessing with -P
Maybe a better solution would be to remove lines with # when generating the hash, but to keep them when compiling Ciao again, Giulio > > > > > Hello, > > verwirren > > I'm not sure, but If you are removing the path of include path in the > preprocessed file - the debugger will be confused finding its source files - > or > what do you think? > > > Mit freundlichen Gruessen > best regards > >Heiko Elger > > > > > > ARBURG GmbH + Co > Heiko Elger > - Softwareentwicklung - / - Research and Development - > Arthur-Hehl-Strasse > D-72290 Lossburg > Tel.: +49 (0) 7446 33-3659 > Fax.: +49 (0) 7446 33-3365 > mailto:heiko_elgernos...@arburg.com > http://www.arburg.com > > Bitte entfernen Sie "NOSPAM" von der Email-Adresse > Please remove "NOSPAM" from the email address >
[ccache] preprocessing with -P
> verwirren > > I'm not sure, but If you are removing the path of include path in the > preprocessed file - the debugger will be confused finding its source files - > or > what do you think? mmmtrue...That could be solved by compiling the original source (and not the preprocessed one) on a cache-miss, though. This way it would actually pre-process twice on a cachemiss but it would then be allowed to share the same cache across different versions of the software being compiled (provided that the interfaces don't change). I think that in my case (big amount of sources and small changes across different versions) it would still be a winner. Maybe it is possible to have it as an option? Ciao, Giulio
[ccache] preprocessing with -P
Hello, verwirren I'm not sure, but If you are removing the path of include path in the preprocessed file - the debugger will be confused finding its source files - or what do you think? Mit freundlichen Gruessen best regards Heiko Elger ARBURG GmbH + Co Heiko Elger - Softwareentwicklung - / - Research and Development - Arthur-Hehl-Strasse D-72290 Lossburg Tel.: +49 (0) 7446 33-3659 Fax.: +49 (0) 7446 33-3365 mailto:heiko_elgernos...@arburg.com http://www.arburg.com Bitte entfernen Sie "NOSPAM" von der Email-Adresse Please remove "NOSPAM" from the email address
[ccache] preprocessing with -P
Dear friends, first of all, thanks a lot for ccache, it is really a great utility! I've produced a little patch which allows to get object file from cache, if the only change is the include path (but not the include itself). Stripping -I from the hashing is not enough: you have to run the preprocessor with -P option, otherwise you will get the full include path in the preprocessed source, making the stripping useless. If you find it a good idea, please include it (at least as an option!) in your sourcetree, so I can avoid to use a patched one. If you think it is not a good idea, please discuss why, as I'm really very interested in your opinion about it. Anyway, here it is: --CUT-HERE-- diff -u -r1.91 ccache.c --- ccache.c28 Sep 2003 04:47:59 - 1.91 +++ ccache.c3 Dec 2003 13:05:42 - @@ -355,9 +355,10 @@ if (!direct_i_file) { /* run cpp on the input file to obtain the .i */ args_add(args, "-E"); + args_add(args, "-P"); args_add(args, input_file); status = execute(args->argv, path_stdout, path_stderr); - args_pop(args, 2); + args_pop(args, 3); } else { /* we are compiling a .i or .ii file - that means we can skip the cpp stage and directly form the --CUT-HERE-- Ciao, Giulio
[ccache] PRB: ccache directory not available
On 2 Dec 2003, heiko_el...@arburg.com wrote: > ccache: version 2.2 > OS: Windows XP Professional > cygwin: latest version > > Hello, > > first of all: we like ccache - its a great utlility - thanks a lot! > > We're using ccache to share compiler output between several people. > All works fine - but if the ccache file server is not available - it would be > nice if ccache compile local instead of generating an error message like the > following: > "ccache: failed to create //ad26080/ccache (No such host or network path)" > > Perhaps a new flag or environement variable or per default fall back to > compile > on local host without try fetching/saving files to ccache directory. > > I searched the man pages for such an option - but without success! > > Perhaps you can add a feature like this in the next release. I think that should be on by default: just emit a warning and then compile without a cache. Probably a one line change. -- Martin linux.conf.au -- Adelaide, January 2004 -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.samba.org/archive/ccache/attachments/20031203/ce520a4d/attachment.bin