From e3fd1387a522f0eacb7cd2743b97d84311ff3f1c Mon Sep 17 00:00:00 2001 From: no-author Date: Wed, 30 Aug 2000 18:56:26 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'bounded-pointers-branch'. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/bounded-pointers-branch@36065 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/g++.old-deja/g++.other/crash22.C | 56 +++ gcc/testsuite/g++.old-deja/g++.other/main2.C | 4 + gcc/testsuite/g++.old-deja/g++.other/scope1.C | 12 + gcc/testsuite/gcc.c-torture/compile/20000825-1.c | 31 ++ gcc/testsuite/gcc.dg/dwarf2-2.c | 18 + gcc/testsuite/gcc.dg/format-ext-3.c | 217 ++++++++++ gcc/testsuite/gcc.dg/format-ext-4.c | 20 + gcc/testsuite/gcc.dg/format-ext-5.c | 21 + gcc/testsuite/gcc.dg/ia64-asm-1.c | 27 ++ gcc/testsuite/gcc.dg/ia64-sync-1.c | 67 +++ gcc/testsuite/gcc.dg/ia64-sync-2.c | 122 ++++++ gcc/testsuite/gcc.dg/return-type-2.c | 47 +++ gcc/testsuite/gcc.dg/wtr-label-1.c | 50 +++ gcc/testsuite/gcc.dg/wtr-suffix-1.c | 35 ++ include/md5.h | 146 +++++++ libiberty/md5.c | 419 +++++++++++++++++++ libstdc++-v3/docs/22_locale/codecvt.html | 512 +++++++++++++++++++++++ 17 files changed, 1804 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/crash22.C create mode 100644 gcc/testsuite/g++.old-deja/g++.other/main2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.other/scope1.C create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000825-1.c create mode 100644 gcc/testsuite/gcc.dg/dwarf2-2.c create mode 100644 gcc/testsuite/gcc.dg/format-ext-3.c create mode 100644 gcc/testsuite/gcc.dg/format-ext-4.c create mode 100644 gcc/testsuite/gcc.dg/format-ext-5.c create mode 100644 gcc/testsuite/gcc.dg/ia64-asm-1.c create mode 100644 gcc/testsuite/gcc.dg/ia64-sync-1.c create mode 100644 gcc/testsuite/gcc.dg/ia64-sync-2.c create mode 100644 gcc/testsuite/gcc.dg/return-type-2.c create mode 100644 gcc/testsuite/gcc.dg/wtr-label-1.c create mode 100644 gcc/testsuite/gcc.dg/wtr-suffix-1.c create mode 100644 include/md5.h create mode 100644 libiberty/md5.c create mode 100644 libstdc++-v3/docs/22_locale/codecvt.html diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash22.C b/gcc/testsuite/g++.old-deja/g++.other/crash22.C new file mode 100644 index 00000000000..89f35f32fe5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/crash22.C @@ -0,0 +1,56 @@ +// Build don't run: +// Special g++ Options: -O2 + +class foo +{ +}; + +typedef void *voidp; +class vect : public foo +{ +public: + voidp& a(); + int b(); +}; + +class bar +{ +public: + bar *c(bool (*f)(bar *node), voidp g) + { + int i=0; + bool j; + while (i < d.b()){ + j = (f == __null) || f((bar*)d.a()); + if (j) + ((bar*)d.a())->c(f, g); + i++; + } + return this; + } + public: + vect d; + bar *e(foo *k); +}; + +bar *bar::e(foo *k) +{ + return c(__null, k); +} + +voidp &vect::a() +{ + static voidp x; + return x; +} + +int vect::b() +{ + static int x; + return x; +} + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/main2.C b/gcc/testsuite/g++.old-deja/g++.other/main2.C new file mode 100644 index 00000000000..ea4870f7a58 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/main2.C @@ -0,0 +1,4 @@ +// Build don't link: +// Origin: Mark Mitchell + +double main () {} // ERROR - main must return `int' diff --git a/gcc/testsuite/g++.old-deja/g++.other/scope1.C b/gcc/testsuite/g++.old-deja/g++.other/scope1.C new file mode 100644 index 00000000000..8b6354cc63f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/scope1.C @@ -0,0 +1,12 @@ +// Testcase for proper scoping of local externs. + +int x = 1; + +int main() +{ + int x = 2; + { + extern int x; + return (x != 1); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000825-1.c b/gcc/testsuite/gcc.c-torture/compile/20000825-1.c new file mode 100644 index 00000000000..3c2e5bda75a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000825-1.c @@ -0,0 +1,31 @@ +typedef signed int s32; +typedef signed long s64; +typedef unsigned int u32; +typedef unsigned long u64; + +extern __inline__ u32 foobar(int logmask) +{ + u32 ret = ~(1 << logmask); // fails + // s32 ret = ~(1 << logmask); // ok + // u64 ret = ~(1 << logmask); // ok + // s64 ret = ~(1 << logmask); // ok + return ret; +} + +// This procedure compiles fine... +u32 good(u32 var) +{ + var = foobar(0); + return var; +} + +// This procedure does not compile... +// Same as above, but formal parameter is a pointer +// Both good() and fails() compile ok if we choose +// a different type for "ret" in foobar(). +u32 fails(u32 *var) +{ + *var = foobar(0); + return *var; +} + diff --git a/gcc/testsuite/gcc.dg/dwarf2-2.c b/gcc/testsuite/gcc.dg/dwarf2-2.c new file mode 100644 index 00000000000..82e5d8de9bb --- /dev/null +++ b/gcc/testsuite/gcc.dg/dwarf2-2.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O -g" } */ + +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Alexandre Oliva */ + +inline double fx (double x) +{ + return 3 * x; +} + +main () +{ + double a = 0, fx (double), foo (); + fx (a); + if (a != 3) + foo (); +} diff --git a/gcc/testsuite/gcc.dg/format-ext-3.c b/gcc/testsuite/gcc.dg/format-ext-3.c new file mode 100644 index 00000000000..54ae6f3f9cd --- /dev/null +++ b/gcc/testsuite/gcc.dg/format-ext-3.c @@ -0,0 +1,217 @@ +/* Test for format extensions beyond the C standard and X/Open standard. + Test for strftime formats. +*/ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -Wformat" } */ + +typedef __SIZE_TYPE__ size_t; + +struct tm; + +extern size_t strftime (char *, size_t, const char *, const struct tm *); + +void +foo (char *s, size_t m, const struct tm *tp) +{ + /* GCC accepts the "-", "_" and "0" flags to control padding on numeric + formats. It also accepts width on these formats. + */ + /* Basic tests of parts on their own. */ + strftime (s, m, "%5C%-C%_C%0C", tp); + /* Correct usages. */ + strftime (s, m, "%-5C%_5C%05C%-5d%_5d%05d%-5e%_5e%05e%-5G%_5G%05G", tp); + strftime (s, m, "%-5H%_5H%05H%-5I%_5I%05I%-5j%_5j%05j%-5m%_5m%05m", tp); + strftime (s, m, "%-5M%_5M%05M%-5S%_5S%05S%-5u%_5u%05u%-5U%_5U%05U", tp); + strftime (s, m, "%-5V%_5V%05V%-5w%_5w%05w%-5W%_5W%05W%-5Y%_5Y%05Y", tp); + /* Correct usages with GNU extension conversion characters. */ + strftime (s, m, "%-5k%_5k%05k%-5l%_5l%05l%-20s%_20s%020s", tp); + /* Correct usages with Y2K problems. */ + strftime (s, m, "%-5g%_5g%05g%-5y%_5y%05y", tp); /* { dg-warning "only last 2" "2-digit year" } */ + /* Incorrect usages. */ + strftime (s, m, "%5a", tp); /* { dg-warning "width" "bad %a" } */ + strftime (s, m, "%-a", tp); /* { dg-warning "flag" "bad %a" } */ + strftime (s, m, "%_a", tp); /* { dg-warning "flag" "bad %a" } */ + strftime (s, m, "%0a", tp); /* { dg-warning "flag" "bad %a" } */ + strftime (s, m, "%5A", tp); /* { dg-warning "width" "bad %A" } */ + strftime (s, m, "%-A", tp); /* { dg-warning "flag" "bad %A" } */ + strftime (s, m, "%_A", tp); /* { dg-warning "flag" "bad %A" } */ + strftime (s, m, "%0A", tp); /* { dg-warning "flag" "bad %A" } */ + strftime (s, m, "%5b", tp); /* { dg-warning "width" "bad %b" } */ + strftime (s, m, "%-b", tp); /* { dg-warning "flag" "bad %b" } */ + strftime (s, m, "%_b", tp); /* { dg-warning "flag" "bad %b" } */ + strftime (s, m, "%0b", tp); /* { dg-warning "flag" "bad %b" } */ + strftime (s, m, "%5B", tp); /* { dg-warning "width" "bad %B" } */ + strftime (s, m, "%-B", tp); /* { dg-warning "flag" "bad %B" } */ + strftime (s, m, "%_B", tp); /* { dg-warning "flag" "bad %B" } */ + strftime (s, m, "%0B", tp); /* { dg-warning "flag" "bad %B" } */ + strftime (s, m, "%5F", tp); /* { dg-warning "width" "bad %F" } */ + strftime (s, m, "%-F", tp); /* { dg-warning "flag" "bad %F" } */ + strftime (s, m, "%_F", tp); /* { dg-warning "flag" "bad %F" } */ + strftime (s, m, "%0F", tp); /* { dg-warning "flag" "bad %F" } */ + strftime (s, m, "%5h", tp); /* { dg-warning "width" "bad %h" } */ + strftime (s, m, "%-h", tp); /* { dg-warning "flag" "bad %h" } */ + strftime (s, m, "%_h", tp); /* { dg-warning "flag" "bad %h" } */ + strftime (s, m, "%0h", tp); /* { dg-warning "flag" "bad %h" } */ + strftime (s, m, "%5n", tp); /* { dg-warning "width" "bad %n" } */ + strftime (s, m, "%-n", tp); /* { dg-warning "flag" "bad %n" } */ + strftime (s, m, "%_n", tp); /* { dg-warning "flag" "bad %n" } */ + strftime (s, m, "%0n", tp); /* { dg-warning "flag" "bad %n" } */ + strftime (s, m, "%5p", tp); /* { dg-warning "width" "bad %p" } */ + strftime (s, m, "%-p", tp); /* { dg-warning "flag" "bad %p" } */ + strftime (s, m, "%_p", tp); /* { dg-warning "flag" "bad %p" } */ + strftime (s, m, "%0p", tp); /* { dg-warning "flag" "bad %p" } */ + strftime (s, m, "%5r", tp); /* { dg-warning "width" "bad %r" } */ + strftime (s, m, "%-r", tp); /* { dg-warning "flag" "bad %r" } */ + strftime (s, m, "%_r", tp); /* { dg-warning "flag" "bad %r" } */ + strftime (s, m, "%0r", tp); /* { dg-warning "flag" "bad %r" } */ + strftime (s, m, "%5R", tp); /* { dg-warning "width" "bad %R" } */ + strftime (s, m, "%-R", tp); /* { dg-warning "flag" "bad %R" } */ + strftime (s, m, "%_R", tp); /* { dg-warning "flag" "bad %R" } */ + strftime (s, m, "%0R", tp); /* { dg-warning "flag" "bad %R" } */ + strftime (s, m, "%5t", tp); /* { dg-warning "width" "bad %t" } */ + strftime (s, m, "%-t", tp); /* { dg-warning "flag" "bad %t" } */ + strftime (s, m, "%_t", tp); /* { dg-warning "flag" "bad %t" } */ + strftime (s, m, "%0t", tp); /* { dg-warning "flag" "bad %t" } */ + strftime (s, m, "%5T", tp); /* { dg-warning "width" "bad %T" } */ + strftime (s, m, "%-T", tp); /* { dg-warning "flag" "bad %T" } */ + strftime (s, m, "%_T", tp); /* { dg-warning "flag" "bad %T" } */ + strftime (s, m, "%0T", tp); /* { dg-warning "flag" "bad %T" } */ + strftime (s, m, "%5X", tp); /* { dg-warning "width" "bad %X" } */ + strftime (s, m, "%-X", tp); /* { dg-warning "flag" "bad %X" } */ + strftime (s, m, "%_X", tp); /* { dg-warning "flag" "bad %X" } */ + strftime (s, m, "%0X", tp); /* { dg-warning "flag" "bad %X" } */ + strftime (s, m, "%5z", tp); /* { dg-warning "width" "bad %z" } */ + strftime (s, m, "%-z", tp); /* { dg-warning "flag" "bad %z" } */ + strftime (s, m, "%_z", tp); /* { dg-warning "flag" "bad %z" } */ + strftime (s, m, "%0z", tp); /* { dg-warning "flag" "bad %z" } */ + strftime (s, m, "%5Z", tp); /* { dg-warning "width" "bad %Z" } */ + strftime (s, m, "%-Z", tp); /* { dg-warning "flag" "bad %Z" } */ + strftime (s, m, "%_Z", tp); /* { dg-warning "flag" "bad %Z" } */ + strftime (s, m, "%0Z", tp); /* { dg-warning "flag" "bad %Z" } */ + /* Incorrect usages with Y2K problems. */ + strftime (s, m, "%5c", tp); /* { dg-warning "width" "bad %c" } */ + strftime (s, m, "%-c", tp); /* { dg-warning "flag" "bad %c" } */ + strftime (s, m, "%_c", tp); /* { dg-warning "flag" "bad %c" } */ + strftime (s, m, "%0c", tp); /* { dg-warning "flag" "bad %c" } */ + strftime (s, m, "%5D", tp); /* { dg-warning "width" "bad %D" } */ + strftime (s, m, "%-D", tp); /* { dg-warning "flag" "bad %D" } */ + strftime (s, m, "%_D", tp); /* { dg-warning "flag" "bad %D" } */ + strftime (s, m, "%0D", tp); /* { dg-warning "flag" "bad %D" } */ + strftime (s, m, "%5x", tp); /* { dg-warning "width" "bad %x" } */ + strftime (s, m, "%-x", tp); /* { dg-warning "flag" "bad %x" } */ + strftime (s, m, "%_x", tp); /* { dg-warning "flag" "bad %x" } */ + strftime (s, m, "%0x", tp); /* { dg-warning "flag" "bad %x" } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 93 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 94 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 95 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 96 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 97 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 98 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 99 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 100 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 101 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 102 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 103 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 104 } */ + /* Incorrect usages with GNU extension conversion characters. */ + strftime (s, m, "%5P", tp); /* { dg-warning "width" "bad %P" } */ + strftime (s, m, "%-P", tp); /* { dg-warning "flag" "bad %P" } */ + strftime (s, m, "%_P", tp); /* { dg-warning "flag" "bad %P" } */ + strftime (s, m, "%0P", tp); /* { dg-warning "flag" "bad %P" } */ + /* The "^" and "#" flags control the case of the output. + ^ (uppercase) makes sense on aAbBhZ; # (change case) makes sense + on the same (though glibc ignores it on bh for some reason; for now our + implementation in GCC follows glibc) and on p. + */ + strftime (s, m, "%^a%#a%^A%#A%^b%^B%#B%^h%^Z%#Z%#p", tp); + /* Bad usages. */ + strftime (s, m, "%#b", tp); /* { dg-warning "flag" "bad %b" } */ + strftime (s, m, "%^C", tp); /* { dg-warning "flag" "bad %C" } */ + strftime (s, m, "%#C", tp); /* { dg-warning "flag" "bad %C" } */ + strftime (s, m, "%^d", tp); /* { dg-warning "flag" "bad %d" } */ + strftime (s, m, "%#d", tp); /* { dg-warning "flag" "bad %d" } */ + strftime (s, m, "%^e", tp); /* { dg-warning "flag" "bad %e" } */ + strftime (s, m, "%#e", tp); /* { dg-warning "flag" "bad %e" } */ + strftime (s, m, "%^F", tp); /* { dg-warning "flag" "bad %F" } */ + strftime (s, m, "%#F", tp); /* { dg-warning "flag" "bad %F" } */ + strftime (s, m, "%^G", tp); /* { dg-warning "flag" "bad %G" } */ + strftime (s, m, "%#G", tp); /* { dg-warning "flag" "bad %G" } */ + strftime (s, m, "%#h", tp); /* { dg-warning "flag" "bad %h" } */ + strftime (s, m, "%^H", tp); /* { dg-warning "flag" "bad %H" } */ + strftime (s, m, "%#H", tp); /* { dg-warning "flag" "bad %H" } */ + strftime (s, m, "%^I", tp); /* { dg-warning "flag" "bad %I" } */ + strftime (s, m, "%#I", tp); /* { dg-warning "flag" "bad %I" } */ + strftime (s, m, "%^j", tp); /* { dg-warning "flag" "bad %j" } */ + strftime (s, m, "%#j", tp); /* { dg-warning "flag" "bad %j" } */ + strftime (s, m, "%^m", tp); /* { dg-warning "flag" "bad %m" } */ + strftime (s, m, "%#m", tp); /* { dg-warning "flag" "bad %m" } */ + strftime (s, m, "%^M", tp); /* { dg-warning "flag" "bad %M" } */ + strftime (s, m, "%#M", tp); /* { dg-warning "flag" "bad %M" } */ + strftime (s, m, "%^n", tp); /* { dg-warning "flag" "bad %n" } */ + strftime (s, m, "%#n", tp); /* { dg-warning "flag" "bad %n" } */ + strftime (s, m, "%^p", tp); /* { dg-warning "flag" "bad %p" } */ + strftime (s, m, "%^r", tp); /* { dg-warning "flag" "bad %r" } */ + strftime (s, m, "%#r", tp); /* { dg-warning "flag" "bad %r" } */ + strftime (s, m, "%^R", tp); /* { dg-warning "flag" "bad %R" } */ + strftime (s, m, "%#R", tp); /* { dg-warning "flag" "bad %R" } */ + strftime (s, m, "%^S", tp); /* { dg-warning "flag" "bad %S" } */ + strftime (s, m, "%#S", tp); /* { dg-warning "flag" "bad %S" } */ + strftime (s, m, "%^t", tp); /* { dg-warning "flag" "bad %t" } */ + strftime (s, m, "%#t", tp); /* { dg-warning "flag" "bad %t" } */ + strftime (s, m, "%^T", tp); /* { dg-warning "flag" "bad %T" } */ + strftime (s, m, "%#T", tp); /* { dg-warning "flag" "bad %T" } */ + strftime (s, m, "%^u", tp); /* { dg-warning "flag" "bad %u" } */ + strftime (s, m, "%#u", tp); /* { dg-warning "flag" "bad %u" } */ + strftime (s, m, "%^U", tp); /* { dg-warning "flag" "bad %U" } */ + strftime (s, m, "%#U", tp); /* { dg-warning "flag" "bad %U" } */ + strftime (s, m, "%^V", tp); /* { dg-warning "flag" "bad %V" } */ + strftime (s, m, "%#V", tp); /* { dg-warning "flag" "bad %V" } */ + strftime (s, m, "%^w", tp); /* { dg-warning "flag" "bad %w" } */ + strftime (s, m, "%#w", tp); /* { dg-warning "flag" "bad %w" } */ + strftime (s, m, "%^W", tp); /* { dg-warning "flag" "bad %W" } */ + strftime (s, m, "%#W", tp); /* { dg-warning "flag" "bad %W" } */ + strftime (s, m, "%^X", tp); /* { dg-warning "flag" "bad %X" } */ + strftime (s, m, "%#X", tp); /* { dg-warning "flag" "bad %X" } */ + strftime (s, m, "%^Y", tp); /* { dg-warning "flag" "bad %Y" } */ + strftime (s, m, "%#Y", tp); /* { dg-warning "flag" "bad %Y" } */ + strftime (s, m, "%^z", tp); /* { dg-warning "flag" "bad %z" } */ + strftime (s, m, "%#z", tp); /* { dg-warning "flag" "bad %z" } */ + strftime (s, m, "%^P", tp); /* { dg-warning "flag" "bad %P" } */ + strftime (s, m, "%#P", tp); /* { dg-warning "flag" "bad %P" } */ + strftime (s, m, "%^k", tp); /* { dg-warning "flag" "bad %k" } */ + strftime (s, m, "%#k", tp); /* { dg-warning "flag" "bad %k" } */ + strftime (s, m, "%^l", tp); /* { dg-warning "flag" "bad %l" } */ + strftime (s, m, "%#l", tp); /* { dg-warning "flag" "bad %l" } */ + strftime (s, m, "%^s", tp); /* { dg-warning "flag" "bad %s" } */ + strftime (s, m, "%#s", tp); /* { dg-warning "flag" "bad %s" } */ + /* Bad usages with Y2K problems. */ + strftime (s, m, "%^c", tp); /* { dg-warning "flag" "bad %c" } */ + strftime (s, m, "%#c", tp); /* { dg-warning "flag" "bad %c" } */ + strftime (s, m, "%^D", tp); /* { dg-warning "flag" "bad %D" } */ + strftime (s, m, "%#D", tp); /* { dg-warning "flag" "bad %D" } */ + strftime (s, m, "%^g", tp); /* { dg-warning "flag" "bad %g" } */ + strftime (s, m, "%#g", tp); /* { dg-warning "flag" "bad %g" } */ + strftime (s, m, "%^x", tp); /* { dg-warning "flag" "bad %x" } */ + strftime (s, m, "%#x", tp); /* { dg-warning "flag" "bad %x" } */ + strftime (s, m, "%^y", tp); /* { dg-warning "flag" "bad %y" } */ + strftime (s, m, "%#y", tp); /* { dg-warning "flag" "bad %y" } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 189 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 190 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 191 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 192 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 193 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 194 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 195 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 196 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 197 } */ + /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 198 } */ + /* GCC also accepts the glibc format extensions %P, %k, %l, %s. */ + strftime (s, m, "%P%k%l%s", tp); + /* GCC also accepts the glibc extension of the "O" modifier on some + more formats. The cases where it is rejected altogether are + covered in c99-strftime-1.c, except for the extension %P. + */ + strftime (s, m, "%OC%Og%OG%Oj%OY%Oz%Ok%Ol%Os", tp); /* { dg-warning "only last 2" "2-digit year" } */ + strftime (s, m, "%OP", tp); /* { dg-warning "flag" "bad %OP" } */ +} diff --git a/gcc/testsuite/gcc.dg/format-ext-4.c b/gcc/testsuite/gcc.dg/format-ext-4.c new file mode 100644 index 00000000000..c0cf740a9e6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format-ext-4.c @@ -0,0 +1,20 @@ +/* Test for scanf formats. %a extensions. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89 -Wformat" } */ + +typedef __WCHAR_TYPE__ wchar_t; + +extern int scanf (const char *, ...); + +void +foo (char **sp, wchar_t **lsp) +{ + /* %a formats for allocation, only recognised in C90 mode, are a + GNU extension. Followed by other characters, %a is not treated + specially. + */ + scanf ("%as", sp); + scanf ("%aS", lsp); + scanf ("%a[bcd]", sp); +} diff --git a/gcc/testsuite/gcc.dg/format-ext-5.c b/gcc/testsuite/gcc.dg/format-ext-5.c new file mode 100644 index 00000000000..e3cce44b446 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format-ext-5.c @@ -0,0 +1,21 @@ +/* Test for gettext default attributes. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -Wformat" } */ + +extern int printf (const char *, ...); + +extern char *gettext (const char *); +extern char *dgettext (const char *, const char *); +extern char *dcgettext (const char *, const char *, int); + +void +foo (int i, long l) +{ + printf (gettext ("%d"), i); + printf (gettext ("%ld"), i); /* { dg-warning "format" "gettext" } */ + printf (dgettext ("", "%d"), i); + printf (dgettext ("", "%ld"), i); /* { dg-warning "format" "dgettext" } */ + printf (dcgettext ("", "%d", 0), i); + printf (dcgettext ("", "%ld", 0), i); /* { dg-warning "format" "dcgettext" } */ +} diff --git a/gcc/testsuite/gcc.dg/ia64-asm-1.c b/gcc/testsuite/gcc.dg/ia64-asm-1.c new file mode 100644 index 00000000000..48b24d31a7a --- /dev/null +++ b/gcc/testsuite/gcc.dg/ia64-asm-1.c @@ -0,0 +1,27 @@ +/* { dg-do run { target ia64-*-* } } */ +/* { dg-options } */ + +/* Test that "=S" properly avoids the post-increment on the memory address. */ + +static void foo(int *x) +{ + long i; + for (i = 0; i < 100; ++i) + __asm__("st4 %0 = r0" : "=S"(x[i])); +} + +int main() +{ + int array[100]; + long i; + + for (i = 0; i < 100; ++i) + array[i] = -1; + + foo(array); + + for (i = 0; i < 100; ++i) + if (array[i]) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/ia64-sync-1.c b/gcc/testsuite/gcc.dg/ia64-sync-1.c new file mode 100644 index 00000000000..d2a9b0bb6e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ia64-sync-1.c @@ -0,0 +1,67 @@ +/* { dg-do run { target ia64-*-* } } */ +/* { dg-options } */ + +/* Test basic functionality of the intrinsics. The operations should + not be optimized away if no one checks the return values. */ + +#include + +static int AI[12]; +static int init_noret_si[12] = { 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0 }; +static int test_noret_si[12] = { 1, 1, 1, 0, 1, 4, 22, -12, 7, 8, 9, 7 }; + +static void +do_noret_si (void) +{ + __sync_val_compare_and_swap(AI+0, 0, 1); + __sync_bool_compare_and_swap(AI+1, 0, 1); + __sync_lock_test_and_set(AI+2, 1); + __sync_lock_release(AI+3); + + __sync_fetch_and_add(AI+4, 1); + __sync_fetch_and_add(AI+5, 4); + __sync_fetch_and_add(AI+6, 22); + __sync_fetch_and_sub(AI+7, 12); + __sync_fetch_and_and(AI+8, 7); + __sync_fetch_and_or(AI+9, 8); + __sync_fetch_and_xor(AI+10, 9); + __sync_fetch_and_nand(AI+11, 7); +} + +static long AL[12]; +static long init_noret_di[12] = { 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0 }; +static long test_noret_di[12] = { 1, 1, 1, 0, 1, 4, 22, -12, 7, 8, 9, 7 }; + +static void +do_noret_di (void) +{ + __sync_val_compare_and_swap(AL+0, 0, 1); + __sync_bool_compare_and_swap(AL+1, 0, 1); + __sync_lock_test_and_set(AL+2, 1); + __sync_lock_release(AL+3); + + __sync_fetch_and_add(AL+4, 1); + __sync_fetch_and_add(AL+5, 4); + __sync_fetch_and_add(AL+6, 22); + __sync_fetch_and_sub(AL+7, 12); + __sync_fetch_and_and(AL+8, 7); + __sync_fetch_and_or(AL+9, 8); + __sync_fetch_and_xor(AL+10, 9); + __sync_fetch_and_nand(AL+11, 7); +} + +int main() +{ + memcpy(AI, init_noret_si, sizeof(init_noret_si)); + memcpy(AL, init_noret_di, sizeof(init_noret_di)); + + do_noret_si (); + do_noret_di (); + + if (memcmp (AI, test_noret_si, sizeof(test_noret_si))) + abort (); + if (memcmp (AL, test_noret_di, sizeof(test_noret_di))) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/ia64-sync-2.c b/gcc/testsuite/gcc.dg/ia64-sync-2.c new file mode 100644 index 00000000000..8d745b01535 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ia64-sync-2.c @@ -0,0 +1,122 @@ +/* { dg-do run { target ia64-*-* } } */ +/* { dg-options } */ + +/* Test basic functionality of the intrinsics. */ + +#include + +static int AI[18]; +static int init_si[18] = { 0,0,0,1,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 }; +static int test_si[18] = { 1,1,1,1,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 }; + +static void +do_si (void) +{ + if (__sync_val_compare_and_swap(AI+0, 0, 1) != 0) + abort (); + if (__sync_val_compare_and_swap(AI+0, 0, 1) != 1) + abort (); + if (__sync_bool_compare_and_swap(AI+1, 0, 1) != 1) + abort (); + if (__sync_bool_compare_and_swap(AI+1, 0, 1) != 0) + abort (); + + if (__sync_lock_test_and_set(AI+2, 1) != 0) + abort (); + + if (__sync_fetch_and_add(AI+4, 1) != 0) + abort (); + if (__sync_fetch_and_add(AI+5, 4) != 0) + abort (); + if (__sync_fetch_and_add(AI+6, 22) != 0) + abort (); + if (__sync_fetch_and_sub(AI+7, 12) != 0) + abort (); + if (__sync_fetch_and_and(AI+8, 7) != -1) + abort (); + if (__sync_fetch_and_or(AI+9, 8) != 0) + abort (); + if (__sync_fetch_and_xor(AI+10, 9) != 0) + abort (); + if (__sync_fetch_and_nand(AI+11, 7) != 0) + abort (); + + if (__sync_add_and_fetch(AI+12, 1) != 1) + abort (); + if (__sync_sub_and_fetch(AI+13, 12) != -12) + abort (); + if (__sync_and_and_fetch(AI+14, 7) != 7) + abort (); + if (__sync_or_and_fetch(AI+15, 8) != 8) + abort (); + if (__sync_xor_and_fetch(AI+16, 9) != 9) + abort (); + if (__sync_nand_and_fetch(AI+17, 7) != 7) + abort (); +} + +static long AL[18]; +static long init_di[18] = { 0,0,0,1,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 }; +static long test_di[18] = { 1,1,1,1,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 }; + +static void +do_di (void) +{ + if (__sync_val_compare_and_swap(AL+0, 0, 1) != 0) + abort (); + if (__sync_val_compare_and_swap(AL+0, 0, 1) != 1) + abort (); + if (__sync_bool_compare_and_swap(AL+1, 0, 1) != 1) + abort (); + if (__sync_bool_compare_and_swap(AL+1, 0, 1) != 0) + abort (); + + if (__sync_lock_test_and_set(AL+2, 1) != 0) + abort (); + + if (__sync_fetch_and_add(AL+4, 1) != 0) + abort (); + if (__sync_fetch_and_add(AL+5, 4) != 0) + abort (); + if (__sync_fetch_and_add(AL+6, 22) != 0) + abort (); + if (__sync_fetch_and_sub(AL+7, 12) != 0) + abort (); + if (__sync_fetch_and_and(AL+8, 7) != -1) + abort (); + if (__sync_fetch_and_or(AL+9, 8) != 0) + abort (); + if (__sync_fetch_and_xor(AL+10, 9) != 0) + abort (); + if (__sync_fetch_and_nand(AL+11, 7) != 0) + abort (); + + if (__sync_add_and_fetch(AL+12, 1) != 1) + abort (); + if (__sync_sub_and_fetch(AL+13, 12) != -12) + abort (); + if (__sync_and_and_fetch(AL+14, 7) != 7) + abort (); + if (__sync_or_and_fetch(AL+15, 8) != 8) + abort (); + if (__sync_xor_and_fetch(AL+16, 9) != 9) + abort (); + if (__sync_nand_and_fetch(AL+17, 7) != 7) + abort (); +} + +int main() +{ + memcpy(AI, init_si, sizeof(init_si)); + memcpy(AL, init_di, sizeof(init_di)); + + do_si (); + do_di (); + + if (memcmp (AI, test_si, sizeof(test_si))) + abort (); + if (memcmp (AL, test_di, sizeof(test_di))) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/return-type-2.c b/gcc/testsuite/gcc.dg/return-type-2.c new file mode 100644 index 00000000000..183c6a88d40 --- /dev/null +++ b/gcc/testsuite/gcc.dg/return-type-2.c @@ -0,0 +1,47 @@ +/* Bogus warnings claiming we fall off the end of a non-void function. + By Kaveh R. Ghazi 8/27/2000. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wreturn-type" } */ + +extern void abort (void) __attribute__ ((__noreturn__)); + +int +foo1 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +__inline__ int +foo2 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +static int +foo3 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +static __inline__ int +foo4 (int i) +{ + if (i) + return i; + + abort (); +} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */ + +int bar (int i) +{ + return foo1 (i) + foo2 (i) + foo3 (i) + foo4 (i); +} diff --git a/gcc/testsuite/gcc.dg/wtr-label-1.c b/gcc/testsuite/gcc.dg/wtr-label-1.c new file mode 100644 index 00000000000..b8d494e7bde --- /dev/null +++ b/gcc/testsuite/gcc.dg/wtr-label-1.c @@ -0,0 +1,50 @@ +/* Test for -Wtraditional warnings on label conflicts with identifiers. + Note, gcc should omit these warnings in system header files. + Origin: Kaveh R. Ghazi 8/24/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +enum foo1 { a }; +struct foo2 { int i; }; +union foo3 { int j; }; +int foo4; +typedef int foo5; + +void +testfunc1 (int foo6) +{ + int foo7; + + foo1: + foo2: + foo3: + foo4: /* { dg-warning "traditional C lacks.*`foo4' conflicts" "label conflicts with identifier" } */ + foo5: /* { dg-warning "traditional C lacks.*`foo5' conflicts" "label conflicts with identifier" } */ + foo6: /* { dg-warning "traditional C lacks.*`foo6' conflicts" "label conflicts with identifier" } */ + foo7: /* { dg-warning "traditional C lacks.*`foo7' conflicts" "label conflicts with identifier" } */ + testfunc1: /* { dg-warning "traditional C lacks.*`testfunc1' conflicts" "label conflicts with identifier" } */ + a: /* { dg-warning "traditional C lacks.*`a' conflicts" "label conflicts with identifier" } */ + i: + j: +} + +#line 32 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +void +testfunc2 (int foo6) +{ + int foo7; + + foo1: + foo2: + foo3: + foo4: + foo5: + foo6: + foo7: + testfunc2: + a: + i: + j: +} diff --git a/gcc/testsuite/gcc.dg/wtr-suffix-1.c b/gcc/testsuite/gcc.dg/wtr-suffix-1.c new file mode 100644 index 00000000000..3a163782c6c --- /dev/null +++ b/gcc/testsuite/gcc.dg/wtr-suffix-1.c @@ -0,0 +1,35 @@ +/* Test for -Wtraditional warnings on integer constant suffixes. + Note, gcc should omit these warnings in system header files. + Origin: Kaveh R. Ghazi 8/24/2000. */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional" } */ + +void +testfunc (void) +{ + int i; + double f; + + i = 1L; + i = 1l; + i = 1U; /* { dg-warning "traditional C rejects the `U' suffix" "numeric constant suffix" } */ + i = 1u; /* { dg-warning "traditional C rejects the `u' suffix" "numeric constant suffix" } */ + f = 1.0; + f = 1.0F; /* { dg-warning "traditional C rejects the `F' suffix" "numeric constant suffix" } */ + f = 1.0f; /* { dg-warning "traditional C rejects the `f' suffix" "numeric constant suffix" } */ + f = 1.0L; /* { dg-warning "traditional C rejects the `L' suffix" "numeric constant suffix" } */ + f = 1.0l; /* { dg-warning "traditional C rejects the `l' suffix" "numeric constant suffix" } */ + +#line 24 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + + i = 1L; + i = 1l; + i = 1U; + i = 1u; + f = 1.0; + f = 1.0F; + f = 1.0f; + f = 1.0L; + f = 1.0l; +} diff --git a/include/md5.h b/include/md5.h new file mode 100644 index 00000000000..ad97efc3213 --- /dev/null +++ b/include/md5.h @@ -0,0 +1,146 @@ +/* md5.h - Declaration of functions and data types used for MD5 sum + computing library functions. + Copyright (C) 1995, 1996 Free Software Foundation, Inc. + NOTE: The canonical source of this file is maintained with the GNU C + Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _MD5_H +#define _MD5_H 1 + +#include + +#if defined HAVE_LIMITS_H || _LIBC +# include +#endif + +/* The following contortions are an attempt to use the C preprocessor + to determine an unsigned integral type that is 32 bits wide. An + alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but + doing that would require that the configure script compile and *run* + the resulting executable. Locally running cross-compiled executables + is usually not possible. */ + +#ifdef _LIBC +# include +typedef u_int32_t md5_uint32; +#else +# if defined __STDC__ && __STDC__ +# define UINT_MAX_32_BITS 4294967295U +# else +# define UINT_MAX_32_BITS 0xFFFFFFFF +# endif + +/* If UINT_MAX isn't defined, assume it's a 32-bit type. + This should be valid for all systems GNU cares about because + that doesn't include 16-bit systems, and only modern systems + (that certainly have ) have 64+-bit integral types. */ + +# ifndef UINT_MAX +# define UINT_MAX UINT_MAX_32_BITS +# endif + +# if UINT_MAX == UINT_MAX_32_BITS + typedef unsigned int md5_uint32; +# else +# if USHRT_MAX == UINT_MAX_32_BITS + typedef unsigned short md5_uint32; +# else +# if ULONG_MAX == UINT_MAX_32_BITS + typedef unsigned long md5_uint32; +# else + /* The following line is intended to evoke an error. + Using #error is not portable enough. */ + "Cannot determine unsigned 32-bit data type." +# endif +# endif +# endif +#endif + +#undef __P +#if defined (__STDC__) && __STDC__ +#define __P(x) x +#else +#define __P(x) () +#endif + +/* Structure to save state of computation between the single steps. */ +struct md5_ctx +{ + md5_uint32 A; + md5_uint32 B; + md5_uint32 C; + md5_uint32 D; + + md5_uint32 total[2]; + md5_uint32 buflen; + char buffer[128]; +}; + +/* + * The following three functions are build up the low level used in + * the functions `md5_stream' and `md5_buffer'. + */ + +/* Initialize structure containing state of computation. + (RFC 1321, 3.3: Step 3) */ +extern void md5_init_ctx __P ((struct md5_ctx *ctx)); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is necessary that LEN is a multiple of 64!!! */ +extern void md5_process_block __P ((const void *buffer, size_t len, + struct md5_ctx *ctx)); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is NOT required that LEN is a multiple of 64. */ +extern void md5_process_bytes __P ((const void *buffer, size_t len, + struct md5_ctx *ctx)); + +/* Process the remaining bytes in the buffer and put result from CTX + in first 16 bytes following RESBUF. The result is always in little + endian byte order, so that a byte-wise output yields to the wanted + ASCII representation of the message digest. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); + + +/* Put result from CTX in first 16 bytes following RESBUF. The result is + always in little endian byte order, so that a byte-wise output yields + to the wanted ASCII representation of the message digest. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf)); + + +/* Compute MD5 message digest for bytes read from STREAM. The + resulting message digest number will be written into the 16 bytes + beginning at RESBLOCK. */ +extern int md5_stream __P ((FILE *stream, void *resblock)); + +/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The + result is always in little endian byte order, so that a byte-wise + output yields to the wanted ASCII representation of the message + digest. */ +extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock)); + +#endif diff --git a/libiberty/md5.c b/libiberty/md5.c new file mode 100644 index 00000000000..d742c54f665 --- /dev/null +++ b/libiberty/md5.c @@ -0,0 +1,419 @@ +/* md5.c - Functions to compute MD5 message digest of files or memory blocks + according to the definition of MD5 in RFC 1321 from April 1992. + Copyright (C) 1995, 1996 Free Software Foundation, Inc. + NOTE: The canonical source of this file is maintained with the GNU C + Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Written by Ulrich Drepper , 1995. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#if STDC_HEADERS || defined _LIBC +# include +# include +#else +# ifndef HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif + +#include "md5.h" + +#ifdef _LIBC +# include +# if __BYTE_ORDER == __BIG_ENDIAN +# define WORDS_BIGENDIAN 1 +# endif +#endif + +#ifdef WORDS_BIGENDIAN +# define SWAP(n) \ + (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) +#else +# define SWAP(n) (n) +#endif + + +/* This array contains the bytes used to pad the buffer to the next + 64-byte boundary. (RFC 1321, 3.1: Step 1) */ +static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; + + +/* Initialize structure containing state of computation. + (RFC 1321, 3.3: Step 3) */ +void +md5_init_ctx (ctx) + struct md5_ctx *ctx; +{ + ctx->A = 0x67452301; + ctx->B = 0xefcdab89; + ctx->C = 0x98badcfe; + ctx->D = 0x10325476; + + ctx->total[0] = ctx->total[1] = 0; + ctx->buflen = 0; +} + +/* Put result from CTX in first 16 bytes following RESBUF. The result + must be in little endian byte order. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +void * +md5_read_ctx (ctx, resbuf) + const struct md5_ctx *ctx; + void *resbuf; +{ + ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); + ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); + ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); + ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); + + return resbuf; +} + +/* Process the remaining bytes in the internal buffer and the usual + prolog according to the standard and write the result to RESBUF. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +void * +md5_finish_ctx (ctx, resbuf) + struct md5_ctx *ctx; + void *resbuf; +{ + /* Take yet unprocessed bytes into account. */ + md5_uint32 bytes = ctx->buflen; + size_t pad; + + /* Now count remaining bytes. */ + ctx->total[0] += bytes; + if (ctx->total[0] < bytes) + ++ctx->total[1]; + + pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; + memcpy (&ctx->buffer[bytes], fillbuf, pad); + + /* Put the 64-bit file length in *bits* at the end of the buffer. */ + *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); + *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | + (ctx->total[0] >> 29)); + + /* Process last bytes. */ + md5_process_block (ctx->buffer, bytes + pad + 8, ctx); + + return md5_read_ctx (ctx, resbuf); +} + +/* Compute MD5 message digest for bytes read from STREAM. The + resulting message digest number will be written into the 16 bytes + beginning at RESBLOCK. */ +int +md5_stream (stream, resblock) + FILE *stream; + void *resblock; +{ + /* Important: BLOCKSIZE must be a multiple of 64. */ +#define BLOCKSIZE 4096 + struct md5_ctx ctx; + char buffer[BLOCKSIZE + 72]; + size_t sum; + + /* Initialize the computation context. */ + md5_init_ctx (&ctx); + + /* Iterate over full file contents. */ + while (1) + { + /* We read the file in blocks of BLOCKSIZE bytes. One call of the + computation function processes the whole buffer so that with the + next round of the loop another block can be read. */ + size_t n; + sum = 0; + + /* Read block. Take care for partial reads. */ + do + { + n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); + + sum += n; + } + while (sum < BLOCKSIZE && n != 0); + if (n == 0 && ferror (stream)) + return 1; + + /* If end of file is reached, end the loop. */ + if (n == 0) + break; + + /* Process buffer with BLOCKSIZE bytes. Note that + BLOCKSIZE % 64 == 0 + */ + md5_process_block (buffer, BLOCKSIZE, &ctx); + } + + /* Add the last bytes if necessary. */ + if (sum > 0) + md5_process_bytes (buffer, sum, &ctx); + + /* Construct result in desired memory. */ + md5_finish_ctx (&ctx, resblock); + return 0; +} + +/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The + result is always in little endian byte order, so that a byte-wise + output yields to the wanted ASCII representation of the message + digest. */ +void * +md5_buffer (buffer, len, resblock) + const char *buffer; + size_t len; + void *resblock; +{ + struct md5_ctx ctx; + + /* Initialize the computation context. */ + md5_init_ctx (&ctx); + + /* Process whole buffer but last len % 64 bytes. */ + md5_process_bytes (buffer, len, &ctx); + + /* Put result in desired memory area. */ + return md5_finish_ctx (&ctx, resblock); +} + + +void +md5_process_bytes (buffer, len, ctx) + const void *buffer; + size_t len; + struct md5_ctx *ctx; +{ + /* When we already have some bits in our internal buffer concatenate + both inputs first. */ + if (ctx->buflen != 0) + { + size_t left_over = ctx->buflen; + size_t add = 128 - left_over > len ? len : 128 - left_over; + + memcpy (&ctx->buffer[left_over], buffer, add); + ctx->buflen += add; + + if (left_over + add > 64) + { + md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx); + /* The regions in the following copy operation cannot overlap. */ + memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], + (left_over + add) & 63); + ctx->buflen = (left_over + add) & 63; + } + + buffer = (const char *) buffer + add; + len -= add; + } + + /* Process available complete blocks. */ + if (len > 64) + { + md5_process_block (buffer, len & ~63, ctx); + buffer = (const char *) buffer + (len & ~63); + len &= 63; + } + + /* Move remaining bytes in internal buffer. */ + if (len > 0) + { + memcpy (ctx->buffer, buffer, len); + ctx->buflen = len; + } +} + + +/* These are the four functions used in the four steps of the MD5 algorithm + and defined in the RFC 1321. The first function is a little bit optimized + (as found in Colin Plumbs public domain implementation). */ +/* #define FF(b, c, d) ((b & c) | (~b & d)) */ +#define FF(b, c, d) (d ^ (b & (c ^ d))) +#define FG(b, c, d) FF (d, b, c) +#define FH(b, c, d) (b ^ c ^ d) +#define FI(b, c, d) (c ^ (b | ~d)) + +/* Process LEN bytes of BUFFER, accumulating context into CTX. + It is assumed that LEN % 64 == 0. */ + +void +md5_process_block (buffer, len, ctx) + const void *buffer; + size_t len; + struct md5_ctx *ctx; +{ + md5_uint32 correct_words[16]; + const md5_uint32 *words = buffer; + size_t nwords = len / sizeof (md5_uint32); + const md5_uint32 *endp = words + nwords; + md5_uint32 A = ctx->A; + md5_uint32 B = ctx->B; + md5_uint32 C = ctx->C; + md5_uint32 D = ctx->D; + + /* First increment the byte count. RFC 1321 specifies the possible + length of the file up to 2^64 bits. Here we only compute the + number of bytes. Do a double word increment. */ + ctx->total[0] += len; + if (ctx->total[0] < len) + ++ctx->total[1]; + + /* Process all bytes in the buffer with 64 bytes in each round of + the loop. */ + while (words < endp) + { + md5_uint32 *cwp = correct_words; + md5_uint32 A_save = A; + md5_uint32 B_save = B; + md5_uint32 C_save = C; + md5_uint32 D_save = D; + + /* First round: using the given function, the context and a constant + the next context is computed. Because the algorithms processing + unit is a 32-bit word and it is determined to work on words in + little endian byte order we perhaps have to change the byte order + before the computation. To reduce the work for the next steps + we store the swapped words in the array CORRECT_WORDS. */ + +#define OP(a, b, c, d, s, T) \ + do \ + { \ + a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ + ++words; \ + CYCLIC (a, s); \ + a += b; \ + } \ + while (0) + + /* It is unfortunate that C does not provide an operator for + cyclic rotation. Hope the C compiler is smart enough. */ +#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) + + /* Before we start, one word to the strange constants. + They are defined in RFC 1321 as + + T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 + */ + + /* Round 1. */ + OP (A, B, C, D, 7, 0xd76aa478); + OP (D, A, B, C, 12, 0xe8c7b756); + OP (C, D, A, B, 17, 0x242070db); + OP (B, C, D, A, 22, 0xc1bdceee); + OP (A, B, C, D, 7, 0xf57c0faf); + OP (D, A, B, C, 12, 0x4787c62a); + OP (C, D, A, B, 17, 0xa8304613); + OP (B, C, D, A, 22, 0xfd469501); + OP (A, B, C, D, 7, 0x698098d8); + OP (D, A, B, C, 12, 0x8b44f7af); + OP (C, D, A, B, 17, 0xffff5bb1); + OP (B, C, D, A, 22, 0x895cd7be); + OP (A, B, C, D, 7, 0x6b901122); + OP (D, A, B, C, 12, 0xfd987193); + OP (C, D, A, B, 17, 0xa679438e); + OP (B, C, D, A, 22, 0x49b40821); + + /* For the second to fourth round we have the possibly swapped words + in CORRECT_WORDS. Redefine the macro to take an additional first + argument specifying the function to use. */ +#undef OP +#define OP(f, a, b, c, d, k, s, T) \ + do \ + { \ + a += f (b, c, d) + correct_words[k] + T; \ + CYCLIC (a, s); \ + a += b; \ + } \ + while (0) + + /* Round 2. */ + OP (FG, A, B, C, D, 1, 5, 0xf61e2562); + OP (FG, D, A, B, C, 6, 9, 0xc040b340); + OP (FG, C, D, A, B, 11, 14, 0x265e5a51); + OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); + OP (FG, A, B, C, D, 5, 5, 0xd62f105d); + OP (FG, D, A, B, C, 10, 9, 0x02441453); + OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); + OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); + OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); + OP (FG, D, A, B, C, 14, 9, 0xc33707d6); + OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); + OP (FG, B, C, D, A, 8, 20, 0x455a14ed); + OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); + OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); + OP (FG, C, D, A, B, 7, 14, 0x676f02d9); + OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); + + /* Round 3. */ + OP (FH, A, B, C, D, 5, 4, 0xfffa3942); + OP (FH, D, A, B, C, 8, 11, 0x8771f681); + OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); + OP (FH, B, C, D, A, 14, 23, 0xfde5380c); + OP (FH, A, B, C, D, 1, 4, 0xa4beea44); + OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); + OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); + OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); + OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); + OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); + OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); + OP (FH, B, C, D, A, 6, 23, 0x04881d05); + OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); + OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); + OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); + OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); + + /* Round 4. */ + OP (FI, A, B, C, D, 0, 6, 0xf4292244); + OP (FI, D, A, B, C, 7, 10, 0x432aff97); + OP (FI, C, D, A, B, 14, 15, 0xab9423a7); + OP (FI, B, C, D, A, 5, 21, 0xfc93a039); + OP (FI, A, B, C, D, 12, 6, 0x655b59c3); + OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); + OP (FI, C, D, A, B, 10, 15, 0xffeff47d); + OP (FI, B, C, D, A, 1, 21, 0x85845dd1); + OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); + OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); + OP (FI, C, D, A, B, 6, 15, 0xa3014314); + OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); + OP (FI, A, B, C, D, 4, 6, 0xf7537e82); + OP (FI, D, A, B, C, 11, 10, 0xbd3af235); + OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); + OP (FI, B, C, D, A, 9, 21, 0xeb86d391); + + /* Add the starting values of the context. */ + A += A_save; + B += B_save; + C += C_save; + D += D_save; + } + + /* Put checksum in context given as argument. */ + ctx->A = A; + ctx->B = B; + ctx->C = C; + ctx->D = D; +} diff --git a/libstdc++-v3/docs/22_locale/codecvt.html b/libstdc++-v3/docs/22_locale/codecvt.html new file mode 100644 index 00000000000..de14677786d --- /dev/null +++ b/libstdc++-v3/docs/22_locale/codecvt.html @@ -0,0 +1,512 @@ + + +

+ Notes on the codecvt implementation. +

+ + +prepared by Benjamin Kosnik (bkoz@redhat.com) on August 28, 2000 + + +

+

+1. Abstract +

+

+The standard class codecvt attempts to address conversions between +different character encoding schemes. In particular, the standard +attempts to detail conversions between the implementation-defined wide +characters (hereafter referred to as wchar_t) and the standard type +char that is so beloved in classic "C" (which can now be referred to +as narrow characters.) This document attempts to describe how the GNU +libstdc++-v3 implementation deals with the conversion between wide and +narrow characters, and also presents a framework for dealing with the +huge number of other encodings that iconv can convert, including +Unicode and UTF8. Design issues and requirements are addressed, and +examples of correct usage for both the required specializations for +wide and narrow characters and the implementation-provided extended +functionality are given. +

+ +

+

+2. What the standard says +

+Around page 425 of the C++ Standard, this charming heading comes into view: + +
+22.2.1.5 - Template class codecvt [lib.locale.codecvt] +
+ +The text around the codecvt definition gives some clues: + +
+ +-1- The class codecvt is for use when +converting from one codeset to another, such as from wide characters +to multibyte characters, between wide character encodings such as +Unicode and EUC. + +
+ +

+Hmm. So, in some unspecified way, Unicode encodings and +translations between other character sets should be handled by this +class. +

+ +
+ +-2- The stateT argument selects the pair of codesets being mapped between. + +
+ +

+Ah ha! Another clue... +

+ +
+ +-3- The instantiations required in the Table ?? +(lib.locale.category), namely codecvt and +codecvt, convert the implementation-defined +native character set. codecvt implements a +degenerate conversion; it does not convert at +all. codecvt converts between the native +character sets for tiny and wide characters. Instantiations on +mbstate_t perform conversion between encodings known to the library +implementor. Other encodings can be converted by specializing on a +user-defined stateT type. The stateT object can contain any state that +is useful to communicate to or from the specialized do_convert member. + +
+ +

+At this point, a couple points become clear: + +

+One: The standard clearly implies that attempts to add non-required +(yet useful and widely used) conversions need to do so through the +third template parameter, stateT.

+ +

+Two: The required conversions, by specifying mbstate_t as the third +template parameter, imply an implementation strategy that is mostly +(or wholly) based on the underlying C library, and the functions +mcsrtombs and wcsrtombs in particular.

+ +

+

+2. Some thoughts on what would be useful +

+Probably the most frequently asked question about code conversion is: +"So dudes, what's the deal with Unicode strings?" The dude part is +optional, but apparently the usefulness of Unicode strings is pretty +widely appreciated. Sadly, this specific encoding (And other useful +encodings like UTF8, UCS4, ISO 8859-10, etc etc etc) are not mentioned +in the C++ standard. + +

+In particular, the simple implementation detail of wchar_t's size +seems to repeatedly confound people. Many systems use a two byte, +unsigned integral type to represent wide characters, and use an +internal encoding of Unicode or UCS2. (See AIX, Microsoft NT, Java, +others.) Other systems, use a four byte, unsigned integral type to +represent wide characters, and use an internal encoding of +UCS4. (GNU/Linux systems using glibc, in particular.) The C +programming language (and thus C++) does not specify a specific size +for the type wchar_t. + +

+Thus, portable C++ code cannot assume a byte size (or endianness) either. + +

+Getting back to the frequently asked question: What about Unicode strings? + +

+What magic spell will do this conversion? + +

+A couple of comments: +

+ +

+The thought that all one needs to convert between two arbitrary +codesets is two types and some kind of state argument is +unfortunate. In particular, encodings may be stateless. The naming of +the third parameter as stateT is unfortunate, as what is really needed +is some kind of generalized type that accounts for the issues that +abstract encodings will need. The minimum information that is required +includes: +

+ +
    +
  • +

    + Identifiers for each of the codesets involved in the conversion. For +example, using the iconv family of functions from the Single Unix +Specification (what used to be called X/Open) hosted on the GNU/Linux +operating system allows bi-directional mapping between far more than +the following tantalizing possibilities: +

    + +(An edited list taken from `iconv --list` on a Red Hat 6.2/Intel system: + +
    +
    +8859_1, 8859_9, 10646-1:1993, 10646-1:1993/UCS4, ARABIC, ARABIC7,
    +ASCII, EUC-CN, EUC-JP, EUC-KR, EUC-TW, GREEK-CCITT, GREEK, GREEK7-OLD,
    +GREEK7, GREEK8, HEBREW, ISO-8859-1, ISO-8859-2, ISO-8859-3,
    +ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8,
    +ISO-8859-9, ISO-8859-10, ISO-8859-11, ISO-8859-13, ISO-8859-14,
    +ISO-8859-15, ISO-10646, ISO-10646/UCS2, ISO-10646/UCS4,
    +ISO-10646/UTF-8, ISO-10646/UTF8, SHIFT-JIS, SHIFT_JIS, UCS-2, UCS-4,
    +UCS2, UCS4, UNICODE, UNICODEBIG, UNICODELITTLE, US-ASCII, US, UTF-8,
    +UTF-16, UTF8, UTF16).
    +
    +
    + +

    +For iconv-based implementations, string literals for each of the +encodings (ie. "UCS-2" and "UTF-8") are necessary, although for other, +non-iconv implementations a table of enumerated values or some other +mechanism may be required. + +

  • + Maximum length of the identifying string literal. + +
  • + Some encodings are require explicit endian-ness. As such, some kind + of endian marker or other byte-order marker will be necessary. See + "Footnotes for C/C++ developers" in Haible for more information on + UCS-2/Unicode endian issues. (Summary: big endian seems most likely, + however implementations, most notably Microsoft, vary.) + +
  • + Types representing the conversion state, for conversions involving + the machinery in the "C" library, or the conversion descriptor, for + conversions using iconv (such as the type iconv_t.) Note that the + conversion descriptor encodes more information than a simple encoding + state type. + +
  • + Conversion descriptors for both directions of encoding. (ie, both + UCS-2 to UTF-8 and UTF-8 to UCS-2.) + +
  • + Something to indicate if the conversion requested if valid. + +
  • + Something to represent if the conversion descriptors are valid. + +
  • + Some way to enforce strict type checking on the internal and + external types. As part of this, the size of the internal and + external types will need to be known. +
+ +

+

+3. Problems with "C" code conversions : thread safety, global locales, + termination. +

+ +In addition, multi-threaded and multi-locale environments also impact +the design and requirements for code conversions. In particular, they +affect the required specialization codecvt +when implemented using standard "C" functions. + +

+Three problems arise, one big, one of medium importance, and one small. + +

+First, the small: mcsrtombs and wcsrtombs may not be multithread-safe +on all systems required by the GNU tools. For GNU/Linux and glibc, +this is not an issue. + +

+Of medium concern, in the grand scope of things, is that the functions +used to implement this specialization work on null-terminated +strings. Buffers, especially file buffers, may not be null-terminated, +thus giving conversions that end prematurely or are otherwise +incorrect. Yikes! + +

+The last, and fundamental problem, is the assumption of a global +locale for all the "C" functions referenced above. For something like +C++ iostreams (where codecvt is explicitly used) the notion of +multiple locales is fundamental. In practice, most users may not run +into this limitation. However, as a quality of implementation issue, +the GNU C++ library would like to offer a solution that allows +multiple locales and or simultaneous usage with computationally +correct results. In short, libstdc++-v3 is trying to offer, as an +option, a high-quality implementation, damn the additional complexity! + +

+For the required specialization codecvt , +conversions are made between the internal character set (always UCS4 +on GNU/Linux) and whatever the currently selected locale for the +LC_CTYPE category implements. + +

+

+4. Design +

+The two required specializations are implemented as follows: + +

+ +codecvt<char, char, mbstate_t> + +

+This is a degenerate (ie, does nothing) specialization. Implementing +this was a piece of cake. + +

+ +codecvt<char, wchar_t, mbstate_t> + +

+This specialization, by specifying all the template parameters, pretty +much ties the hands of implementors. As such, the implementation is +straightforward, involving mcsrtombs for the conversions between char +to wchar_t and wcsrtombs for conversions between wchar_t and char. + +

+Neither of these two required specializations deals with Unicode +characters. As such, libstdc++-v3 implements a partial specialization +of the codecvt class with and iconv wrapper class, __enc_traits as the +third template parameter. + +

+This implementation should be standards conformant. First of all, the +standard explicitly points out that instantiations on the third +template parameter, stateT, are the proper way to implement +non-required conversions. Second of all, the standard says (in Chapter +17) that partial specializations of required classes are a-ok. Third +of all, the requirements for the stateT type elsewhere in the standard +(see 21.1.2 traits typedefs) only indicate that this type be copy +constructible. + +

+As such, the type __enc_traits is defined as a non-templatized, POD +type to be used as the third type of a codecvt instantiation. This +type is just a wrapper class for iconv, and provides an easy interface +to iconv functionality. + +

+There are two constructors for __enc_traits: + +

+ +__enc_traits() : __in_desc(0), __out_desc(0) + +

+This default constructor sets the internal encoding to some default +(currently UCS4) and the external encoding to whatever is returned by +nl_langinfo(CODESET). + +

+ +__enc_traits(const char* __int, const char* __ext) + +

+This constructor takes as parameters string literals that indicate the +desired internal and external encoding. There are no defaults for +either argument. + +

+One of the issues with iconv is that the string literals identifying +conversions are not standardized. Because of this, the thought of +mandating and or enforcing some set of pre-determined valid +identifiers seems iffy: thus, a more practical (and non-migraine +inducing) strategy was implemented: end-users can specify any string +(subject to a pre-determined length qualifier, currently 32 bytes) for +encodings. It is up to the user to make sure that these strings are +valid on the target system. + +

+ +void +_M_init() + +

+Strangely enough, this member function attempts to open conversion +descriptors for a given __enc_traits object. If the conversion +descriptors are not valid, the conversion descriptors returned will +not be valid and the resulting calls to the codecvt conversion +functions will return error. + +

+ +bool +_M_good() + +

+Provides a way to see if the given __enc_traits object has been +properly initialized. If the string literals describing the desired +internal and external encoding are not valid, initialization will +fail, and this will return false. If the internal and external +encodings are valid, but iconv_open could not allocate conversion +descriptors, this will also return false. Otherwise, the object is +ready to convert and will return true. + +

+ +__enc_traits(const __enc_traits&) + +

+As iconv allocates memory and sets up conversion descriptors, the copy +constructor can only copy the member data pertaining to the internal +and external code conversions, and not the conversion descriptors +themselves. + +

+Definitions for all the required codecvt member functions are provided +for this specialization, and usage of codecvt is consistent with other +codecvt usage. + +

+

+5. Examples +

+a. conversions involving string literals + +
+  typedef codecvt_base::result			result;
+  typedef unsigned short			unicode_t;
+  typedef unicode_t				int_type;
+  typedef char					ext_type;
+  typedef __enc_traits				enc_type;
+  typedef codecvt	unicode_codecvt;
+
+  const ext_type* 	e_lit = "black pearl jasmine tea";
+  int 			size = strlen(e_lit);
+  int_type 		i_lit_base[24] = 
+  { 25088, 27648, 24832, 25344, 27392, 8192, 28672, 25856, 24832, 29184, 
+    27648, 8192, 27136, 24832, 29440, 27904, 26880, 28160, 25856, 8192, 29696,
+    25856, 24832, 2560
+  };
+  const int_type* 	i_lit = i_lit_base;
+  const ext_type*       efrom_next;
+  const int_type*       ifrom_next;
+  ext_type* 		e_arr = new ext_type[size + 1];
+  ext_type*		eto_next;
+  int_type* 		i_arr = new int_type[size + 1];
+  int_type*		ito_next;
+
+  // construct a locale object with the specialized facet.
+  locale 		loc(locale::classic(), new unicode_codecvt);
+  // sanity check the constructed locale has the specialized facet.
+  VERIFY( has_facet(loc) );
+  const unicode_codecvt&	cvt = use_facet(loc); 
+  // convert between const char* and unicode strings
+  unicode_codecvt::state_type state01("UNICODE", "ISO_8859-1");
+  initialize_state(state01);
+  result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next, 
+		     i_arr, i_arr + size, ito_next);
+  VERIFY( r1 == codecvt_base::ok );
+  VERIFY( !int_traits::compare(i_arr, i_lit, size) ); 
+  VERIFY( efrom_next == e_lit + size );
+  VERIFY( ito_next == i_arr + size );
+
+ b. conversions involving std::string + c. conversions involving std::filebuf and std::ostream + +More information can be found in the following testcases: +codecvt_char_char.cc +codecvt_unicode_wchar_t.cc +codecvt_unicode_char.cc +codecvt_wchar_t_char.cc + +

+

+6. Unresolved Issues +

+
    +
  • + a. things that are sketchy, or remain unimplemented + do_encoding, max_length and length member functions + are only weakly implemented. I have no idea how to do + this correctly, and in a generic manner. Nathan? + +
  • + b. conversions involving std::string + +
      +
    • + how should operators != and == work for string of + different/same encoding? + +
    • + what is equal? A byte by byte comparison or an + encoding then byte comparison? + +
    • + conversions between narrow, wide, and unicode strings +
    +
  • + c. conversions involving std::filebuf and std::ostream +
      +
    • + how to initialize the state object in a + standards-conformant manner? + +
    • + how to synchronize the "C" and "C++" conversion information? + +
    • + wchar_t/char internal buffers and conversions between + internal/external buffers? +
    +
+ +

+

+7. Acknowledgments +

+Ulrich Drepper for the iconv suggestions and patient answering of +late-night questions, Jason Merrill for the template partial +specialization hints, language clarification, and wchar_t fixes. + +

+

+8. Bibliography / Referenced Documents +

+ +Drepper, Ulrich, GNU libc (glibc) 2.2 manual. In particular, Chapters "6. Character Set Handling" and "7 Locales and Internationalization" + +

+Drepper, Ulrich, Numerous, late-night email correspondence + +

+Feather, Clive, "A brief description of Normative Addendum 1," in particular the parts on Extended Character Sets +http://www.lysator.liu.se/c/na1.html + +

+Haible, Bruno, "The Unicode HOWTO" v0.18, 4 August 2000 +ftp://ftp.ilog.fr/pub/Users/haible/utf8/Unicode-HOWTO.html + +

+ISO/IEC 14882:1998 Programming languages - C++ + +

+ISO/IEC 9899:1999 Programming languages - C + +

+Khun, Markus, "UTF-8 and Unicode FAQ for Unix/Linux" +http://www.cl.cam.ac.uk/~mgk25/unicode.html + +

+Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc. 2000 + +

+Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc. 2000 + +

+System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x) +The Open Group/The Institute of Electrical and Electronics Engineers, Inc. +http://www.opennc.org/austin/docreg.html + + -- cgit v1.2.3