Date: Wed, 29 May 2002 20:43:25 +0100 From: "Richard Dawe" Sender: rich AT phekda DOT freeserve DOT co DOT uk To: djgpp-workers AT delorie DOT com X-Mailer: Emacs 21.2.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 Subject: Patches for building with gcc 3.1 - tests chunk Message-Id: Reply-To: djgpp-workers AT delorie DOT com Hello. Here's the chunk of the patch for building DJGPP's tests with gcc 3.1. I think this all pretty simple stuff - making printf() format strings agree with arguments - apart from: * stdarg.c - need to decide what to about __dj_va_rounded_size; * signals.c - is the typecasting valid? If there are no objections, I'd like to commit the patches to the other files. Thanks, bye, Rich =] Index: tests/libc/ansi/stdarg/stdarg.c =================================================================== RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdarg/stdarg.c,v retrieving revision 1.1 diff -p -u -3 -r1.1 stdarg.c --- tests/libc/ansi/stdarg/stdarg.c 1995/03/20 07:51:50 1.1 +++ tests/libc/ansi/stdarg/stdarg.c 2002/05/26 17:28:51 @@ -5,7 +5,9 @@ void x(const char *f, ...) { const char *c; va_list a; +#if __GNUC__ < 3 printf("rounded size of f is %ld\n", __dj_va_rounded_size(f)); +#endif va_start(a, f); printf("&f = %p\n", &f); printf("a = %p\n", a); Index: tests/libc/ansi/stdio/tscanf.c =================================================================== RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdio/tscanf.c,v retrieving revision 1.1 diff -p -u -3 -r1.1 tscanf.c --- tests/libc/ansi/stdio/tscanf.c 1999/04/18 14:27:36 1.1 +++ tests/libc/ansi/stdio/tscanf.c 2002/05/26 17:28:52 @@ -32,7 +32,7 @@ int convert_and_print (const char *fmt, memset (cbuf, 0, sizeof cbuf); converted = sscanf (buf, fmt, cbuf); - printf ("`%s' converted %ld characters, result: %s\n", + printf ("`%s' converted %lu characters, result: %s\n", fmt, strlen (cbuf), cbuf); return converted; } Index: tests/libc/ansi/stdio/tsnprtf.c =================================================================== RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdio/tsnprtf.c,v retrieving revision 1.1 diff -p -u -3 -r1.1 tsnprtf.c --- tests/libc/ansi/stdio/tsnprtf.c 2001/05/21 20:25:49 1.1 +++ tests/libc/ansi/stdio/tsnprtf.c 2002/05/26 17:28:57 @@ -4,6 +4,7 @@ #include #include +#include #include int @@ -26,7 +27,7 @@ main (void) { fprintf(stderr, "FAILED snprintf\n"); fprintf(stderr, - "sizeof (%ld), snprintf(%d), strlen(%ld)\n", + "sizeof (%lu), snprintf(%d), strlen(%lu)\n", sizeof(holder), i, strlen(BIG)) ; exit(EXIT_FAILURE); } @@ -106,7 +107,7 @@ main (void) { fprintf(stderr, "FAILED with padding larger than buffer: %d output, " - "%ld written to buffer\n", + "%lu written to buffer\n", i, strlen(holder)); exit(EXIT_FAILURE); } @@ -122,7 +123,7 @@ main (void) { fprintf(stderr, "FAILED with precision larger than buffer: %d output, " - "%ld written to buffer\n", + "%lu written to buffer\n", i, strlen(holder)); exit(EXIT_FAILURE); } Index: tests/libc/ansi/stdio/tsnprtf2.c =================================================================== RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdio/tsnprtf2.c,v retrieving revision 1.1 diff -p -u -3 -r1.1 tsnprtf2.c --- tests/libc/ansi/stdio/tsnprtf2.c 2001/05/21 20:25:49 1.1 +++ tests/libc/ansi/stdio/tsnprtf2.c 2002/05/26 17:28:57 @@ -10,7 +10,7 @@ * and vsnprintf() both invoke _doprnt(). */ int -_doprnt (const char *format, void *params, FILE *file) +_doprnt (const char *format, va_list args, FILE *file) { return(-1); } Index: tests/libc/ansi/stdlib/system2.c =================================================================== RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdlib/system2.c,v retrieving revision 1.2 diff -p -u -3 -r1.2 system2.c --- tests/libc/ansi/stdlib/system2.c 1999/12/24 21:06:27 1.2 +++ tests/libc/ansi/stdlib/system2.c 2002/05/26 17:29:04 @@ -9,25 +9,25 @@ main (int argc, char **argv) if (argc <= 1) { /* Assuming we have a djecho.exe: */ - res = system ("djecho - William Safire's Rules for Writers: - -Remember to never split an infinitive. The passive voice should never be used. -Do not put statements in the negative form. Verbs have to agree with their -subjects. Proofread carefully to see if you words out. If you reread your work, -you can find on rereading a great deal of repetition can be avoided by -rereading and editing. A writer must not shift your point of view. And don't -start a sentence with a conjunction. (Remember, too, a preposition is a -terrible word to end a sentence with.) Don't overuse exclamation marks!! -Place pronouns as close as possible, especially in long sentences, as of 10 -or more words, to their antecedents. Writing carefully, dangling participles -must be avoided. If any word is improper at the end of a sentence, a linking -verb is. Take the bull by the hand and avoid mixing metaphors. Avoid trendy -locutions that sound flaky. Everyone should be careful to use a singular -pronoun with singular nouns in their writing. Always pick on the correct idiom. -The adverb always follows the verb. Last but not least, avoid cliches like the -plague; seek viable alternatives. -> rules.tmp"); + res = system ("djecho" +" William Safire's Rules for Writers:" +"" +"Remember to never split an infinitive. The passive voice should never be used." +"Do not put statements in the negative form. Verbs have to agree with their" +"subjects. Proofread carefully to see if you words out. If you reread your work," +"you can find on rereading a great deal of repetition can be avoided by" +"rereading and editing. A writer must not shift your point of view. And don't" +"start a sentence with a conjunction. (Remember, too, a preposition is a" +"terrible word to end a sentence with.) Don't overuse exclamation marks!!" +"Place pronouns as close as possible, especially in long sentences, as of 10" +"or more words, to their antecedents. Writing carefully, dangling participles" +"must be avoided. If any word is improper at the end of a sentence, a linking" +"verb is. Take the bull by the hand and avoid mixing metaphors. Avoid trendy" +"locutions that sound flaky. Everyone should be careful to use a singular" +"pronoun with singular nouns in their writing. Always pick on the correct idiom." +"The adverb always follows the verb. Last but not least, avoid cliches like the" +"plague; seek viable alternatives." +"> rules.tmp"); if (!res) res = system ("sed s/s/z/g < rules.tmp | tail"); } Index: tests/libc/crt0/sections.c =================================================================== RCS file: /cvs/djgpp/djgpp/tests/libc/crt0/sections.c,v retrieving revision 1.1 diff -p -u -3 -r1.1 sections.c --- tests/libc/crt0/sections.c 1995/11/12 15:48:12 1.1 +++ tests/libc/crt0/sections.c 2002/05/26 17:29:10 @@ -1,4 +1,5 @@ #include +#include int d1 = 0x12345678; int d2 = 0x76543210; @@ -23,7 +24,7 @@ main(void) c = bss; e = c + sizeof(bss); - printf("bss scan from %p to %p, %lu bytes\n", c, e, e-c); + printf("bss scan from %p to %p, %d bytes\n", c, e, (ptrdiff_t) (e-c)); while (c < e) { if (*c) Index: tests/libc/go32/signals.c =================================================================== RCS file: /cvs/djgpp/djgpp/tests/libc/go32/signals.c,v retrieving revision 1.1 diff -p -u -3 -r1.1 signals.c --- tests/libc/go32/signals.c 1999/05/09 11:34:55 1.1 +++ tests/libc/go32/signals.c 2002/05/26 17:29:19 @@ -20,7 +20,7 @@ void int_handler(int sig) if (sig != SIGINT) abort(); puts ("\tSIGINT"); - urand = ((double)rand()) / RAND_MAX; + urand = ((double)(long)rand()) / RAND_MAX; if (urand > 0.5) result = urand / (rand() < 0); else