* g++.dg/charset/extern2.cc (foo): Declare as of type cost char*.
* g++.dg/charset/string.c (foo): Likewise.
* g++.dg/ext/builtin1.C (printf): Change first parameter type to
const char*
* g++.dg/ext/builtin2.C (printf): Likewise.
* g++.dg/init/new15.C (printf): Likewise.
* g++.dg/opt/pr17697-1.C (foo): Likewise.
* g++.dg/opt/pr17697-2.C (foo): Likewise.
* g++.dg/opt/pr17697-3.C (foo): Likewise.
* g++.dg/template/non-dependent4.C (temp): Likewise.
* g++.dg/opt/strength-reduce.C (C::a): Change type to const char*.
* g++.old-deja/g++.brendan/crash66.C (getopt): Change last
parameter type to const char*.
* g++.old-deja/g++.brendan/ptolemy1.C (InterpTableEntry::name):
Change type to const char*.
* g++.old-deja/g++.brendan/ptolemy2.C (InterpTableEntry::name):
Likewise.
* g++.old-deja/g++.jason/default2.C (bar::memberfunction): Change
second parameter type to const char*.
* g++.old-deja/g++.jason/opeq.C (X::X): Likewise.
(Y::Y): Change parameter type to const char*.
* g++.old-deja/g++.jason/ref12.C (f): Likewise.
* g++.old-deja/g++.jason/report.C: Apply const correctness.
* g++.old-deja/g++.jason/rfg6.C (single, array): Likewise.
* g++.old-deja/g++.jason/rvalue1.C (main): Cast string literal to
(char*).
* g++.old-deja/g++.jason/scoping4.C (A::Ptr): Make a typedef to
const char*.
* g++.old-deja/g++.law/ctors17.C (X::X): Change last parameter
type to const char*.
* g++.old-deja/g++.law/ctors7.C (base_t::name, d1_t, d2_t): Change
return type to const char*.
* g++.old-deja/g++.law/dtors2.C (bla::bla): Change parameter type
to const char*.
* g++.old-deja/g++.law/operators3.C: Adjust for const correctness.
* g++.old-deja/g++.law/refs1.C: Likewise.
* g++.old-deja/g++.law/visibility1.C: Likewise.
* g++.old-deja/g++.law/visibility2.C: Likewise.
* g++.old-deja/g++.law/union1.C (op_to_charp::s): Change type to
const char*.
* g++.old-deja/g++.mike/bool2.C: Adjust for const correctness..
* g++.old-deja/g++.mike/net48.C: Likewise.
* g++.old-deja/g++.mike/p646.C: Likewise.
* g++.old-deja/g++.mike/p6746.C: Likewise.
* g++.old-deja/g++.mike/p700.C (mystrcpy): Change last parameter
type to const char*.
* g++.old-deja/g++.mike/p811.C (X::stringify): Match for
deprecated conversion warning.
* g++.old-deja/g++.other/init15.C (A::name): Change type to const
char*.
* g++.old-deja/g++.other/inline12.C: Adjust for const correctness.
* g++.old-deja/g++.other/sibcall1.C (foo): Likewise.
* g++.old-deja/g++.pt/explicit8.C: Likewise.
* g++.old-deja/g++.pt/m6.C (xx): Likewise.
* g++.old-deja/g++.pt/m7.C (xx): Likewise.
* g++.old-deja/g++.pt/nontype3.C: Likewise.
* g++.old-deja/g++.pt/t39.C: Likewise.
* g++.old-deja/g++.robertl/eb106.C: Likewise.
* g++.old-deja/g++.robertl/ice990323-2.C: Likewise.
From-SVN: r110608
+2006-02-05 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * g++.dg/charset/extern2.cc (foo): Declare as of type cost char*.
+ * g++.dg/charset/string.c (foo): Likewise.
+ * g++.dg/ext/builtin1.C (printf): Change first parameter type to
+ const char*
+ * g++.dg/ext/builtin2.C (printf): Likewise.
+ * g++.dg/init/new15.C (printf): Likewise.
+ * g++.dg/opt/pr17697-1.C (foo): Likewise.
+ * g++.dg/opt/pr17697-2.C (foo): Likewise.
+ * g++.dg/opt/pr17697-3.C (foo): Likewise.
+ * g++.dg/template/non-dependent4.C (temp): Likewise.
+ * g++.dg/opt/strength-reduce.C (C::a): Change type to const char*.
+ * g++.old-deja/g++.brendan/crash66.C (getopt): Change last
+ parameter type to const char*.
+ * g++.old-deja/g++.brendan/ptolemy1.C (InterpTableEntry::name):
+ Change type to const char*.
+ * g++.old-deja/g++.brendan/ptolemy2.C (InterpTableEntry::name):
+ Likewise.
+ * g++.old-deja/g++.jason/default2.C (bar::memberfunction): Change
+ second parameter type to const char*.
+ * g++.old-deja/g++.jason/opeq.C (X::X): Likewise.
+ (Y::Y): Change parameter type to const char*.
+ * g++.old-deja/g++.jason/ref12.C (f): Likewise.
+ * g++.old-deja/g++.jason/report.C: Apply const correctness.
+ * g++.old-deja/g++.jason/rfg6.C (single, array): Likewise.
+ * g++.old-deja/g++.jason/rvalue1.C (main): Cast string literal to
+ (char*).
+ * g++.old-deja/g++.jason/scoping4.C (A::Ptr): Make a typedef to
+ const char*.
+ * g++.old-deja/g++.law/ctors17.C (X::X): Change last parameter
+ type to const char*.
+ * g++.old-deja/g++.law/ctors7.C (base_t::name, d1_t, d2_t): Change
+ return type to const char*.
+ * g++.old-deja/g++.law/dtors2.C (bla::bla): Change parameter type
+ to const char*.
+ * g++.old-deja/g++.law/operators3.C: Adjust for const correctness.
+ * g++.old-deja/g++.law/refs1.C: Likewise.
+ * g++.old-deja/g++.law/visibility1.C: Likewise.
+ * g++.old-deja/g++.law/visibility2.C: Likewise.
+ * g++.old-deja/g++.law/union1.C (op_to_charp::s): Change type to
+ const char*.
+ * g++.old-deja/g++.mike/bool2.C: Adjust for const correctness..
+ * g++.old-deja/g++.mike/net48.C: Likewise.
+ * g++.old-deja/g++.mike/p646.C: Likewise.
+ * g++.old-deja/g++.mike/p6746.C: Likewise.
+ * g++.old-deja/g++.mike/p700.C (mystrcpy): Change last parameter
+ type to const char*.
+ * g++.old-deja/g++.mike/p811.C (X::stringify): Match for
+ deprecated conversion warning.
+ * g++.old-deja/g++.other/init15.C (A::name): Change type to const
+ char*.
+ * g++.old-deja/g++.other/inline12.C: Adjust for const correctness.
+ * g++.old-deja/g++.other/sibcall1.C (foo): Likewise.
+ * g++.old-deja/g++.pt/explicit8.C: Likewise.
+ * g++.old-deja/g++.pt/m6.C (xx): Likewise.
+ * g++.old-deja/g++.pt/m7.C (xx): Likewise.
+ * g++.old-deja/g++.pt/nontype3.C: Likewise.
+ * g++.old-deja/g++.pt/t39.C: Likewise.
+ * g++.old-deja/g++.robertl/eb106.C: Likewise.
+ * g++.old-deja/g++.robertl/ice990323-2.C: Likewise.
+
2006-02-04 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/25075
/* { dg-do compile }
{ dg-require-iconv "IBM1047" }
{ dg-final { scan-assembler-not "foobar" } } */
-extern "C" { char *foo = "foobar"; }
+extern "C" { const char* foo = "foobar"; }
/* { dg-do compile }
{ dg-require-iconv "IBM1047" }
{ dg-final { scan-assembler-not "string foobar" } } */
-char *foo = "string foobar";
+const char* foo = "string foobar";
// { dg-options "" }
// { dg-final { scan-assembler "fancy_printf" } }
-extern "C" int printf(char*, ...) __asm("_fancy_printf");
+extern "C" int printf(const char*, ...) __asm("_fancy_printf");
void foo() { printf("abc"); }
// { dg-options "" }
// { dg-final { scan-assembler "fancy_printf" } }
-extern "C" int printf(char*, ...) __asm("_fancy_printf");
+extern "C" int printf(const char*, ...) __asm("_fancy_printf");
namespace std { using ::printf; }
// PR c++/9782
-extern "C" void printf(char *, ...);
+extern "C" void printf(const char*, ...);
template <int>
struct A {
}
int
-foo (char *x) throw ()
+foo (const char *x) throw ()
{
return A::strcmp ("", x);
}
}
int
-foo (char *x) throw ()
+foo (const char *x) throw ()
{
return A::strcmp ("", x);
}
}
int
-foo (char *x)
+foo (const char *x)
{
return A::strcmp ("", x);
}
{
int foo (char ch, int offset = __INT_MAX__) const;
int bar (int offset, char c) const;
- char *a;
+ const char *a;
};
int C::bar (int offset, char c) const
-int temp(char *temp);
+int temp(const char *temp);
template <int> int g() { return temp("Hi"); }
int g1() { return temp("Hi"); }
ulong compression_quality;
char *compressfile;
int debug_level;
-extern "C" int getopt (int, char**, char*);
+extern "C" int getopt (int, char**, const char*);
int
main(int argc, char** argv)
{
typedef int (PTcl::*InterpFuncP)(int,char**);
struct InterpTableEntry {
- char* name;
+ const char* name;
InterpFuncP func;
};
typedef int (PTcl::*InterpFuncP)(int,char**);
struct InterpTableEntry {
- char* name;
+ const char* name;
InterpFuncP func;
};
{
public:
bar();
- int memberfunction(int i, char *j, double k, foo foo1 = foo(0));
+ int memberfunction(int i, const char *j, double k, foo foo1 = foo(0));
};
int
class Y
{
public:
- Y(char*) {}
+ Y(const char*) {}
Y& operator = (const Y&) { return *this; }
};
class X
{
public:
- X(int v, char* m) : _v(v), _m (m) {}
+ X(int v, const char* m) : _v(v), _m (m) {}
X () : _v(0), _m("Unknown") {}
// Defining our own op= here makes things work correctly.
// { dg-do run }
-void f (char *const &) { }
+void f (const char *const &) { }
int main ()
{
f ("hi");
operator int () { return a; }
};
-extern "C" int atoi (char *);
+extern "C" int atoi (const char *);
-int (*fee)(char *) = atoi;
-int (**bar)(char *) = &fee;
+int (*fee)(const char *) = atoi;
+int (**bar)(const char *) = &fee;
-char *s = "4";
-char **sp = &s;
-char ***spp = &sp;
+const char* s = "4";
+const char** sp = &s;
+const char*** spp = &sp;
int foo (int a = (**bar) (s))
{
// { dg-do assemble }
-wchar_t *single = L"xyz" ;
-wchar_t *(array[]) = { L"xyz" };
+const wchar_t *single = L"xyz" ;
+const wchar_t *(array[]) = { L"xyz" };
int main(void)
{
- Class1 *class1 = new Class1("Hi!");
+ Class1 *class1 = new Class1((char*) "Hi!");
}
class A {
public:
- typedef char * Ptr;
+ typedef const char * Ptr;
Ptr s;
Ptr get_string();
A(Ptr string); // { s = string; };
class X : public std::ifstream { // { dg-error "" } candidate
public:
- X(int a, char *b) {} // { dg-error "" } candidate
+ X(int a, const char *b) {} // { dg-error "" } candidate
};
int main()
{
class base_t {
public:
- virtual char *name () { return "base_t"; }
+ virtual const char* name () { return "base_t"; }
base_t ();
virtual ~base_t ();
class d1_t : public base_t {
public:
- virtual char *name () { return "d1_t"; }
+ virtual const char* name () { return "d1_t"; }
// The const keyword on this constructor is an error, but it shouldn't
// cause the compiler to crash.
class d2_t : public base_t {
public:
- virtual char *name () { return "d2_t"; }
+ virtual const char* name () { return "d2_t"; }
d2_t (int);
virtual ~d2_t ();
public:
- inline bla(char * jim) { ; };
+ inline bla(const char * jim) { ; };
inline ~bla() { destruct++; if (destruct == 2) printf ("PASS\n");};
};
{
public:
- operator char*() const { return myData; }
- char* myData;
+ operator const char*() const { return myData; }
+ const char* myData;
};
void bug1()
{
BUG1 bug1;
bug1.myData = "0123456789";
- char* s = bug1 + 1;
+ const char* s = bug1 + 1;
}
class C {
private:
- char** list;
+ const char** list;
public:
- C(char** );
+ C(const char** );
void count (int&);
};
-C::C (char** l) {
+C::C (const char** l) {
list = l;
}
}
}
-char * foo[] = {
+const char * foo[] = {
"one", "two", "three", NULL};
int main() {
typedef enum { BADUNOP = 0, NEG = POWR+1, SIN, COS, TAN } unoptype;
typedef struct {
- char *s;
+ const char *s;
union {
binoptype bop;
unoptype uop;
class base {
//==========
- void base_priv(char * n)
+ void base_priv(const char * n)
{ std::cout << "base_priv called from: " << n << "\n"; };
protected:
- void base_prot(char * n)
+ void base_prot(const char * n)
{ std::cout << "base_prot called from: " << n << "\n"; };
public:
- void base_publ(char * n)
+ void base_publ(const char * n)
{ std::cout << "base_publ called from: " << n << "\n"; };
- void test(char * n) { base_publ(n); base_prot(n); base_priv(n); }
+ void test(const char * n) { base_publ(n); base_prot(n); base_priv(n); }
}; // class base
public :
- void test(char * n) { base_publ(n); base_prot(n);}
+ void test(const char * n) { base_publ(n); base_prot(n);}
}; // class derived
class base {
//==========
- void base_priv(char * n)
+ void base_priv(const char * n)
{ std::cout << "base_priv called from: " << n << "\n"; };
protected:
- void base_prot(char * n)
+ void base_prot(const char * n)
{ std::cout << "base_prot called from: " << n << "\n"; };
public:
- void base_publ(char * n)
+ void base_publ(const char * n)
{ std::cout << "base_publ called from: " << n << "\n"; };
- void test(char * n) { base_publ(n); base_prot(n); base_priv(n); }
+ void test(const char * n) { base_publ(n); base_prot(n); base_priv(n); }
}; // class base
public :
- void test(char * n) { base_publ(n); base_prot(n);}
+ void test(const char * n) { base_publ(n); base_prot(n);}
}; // class derived
} a1;
class A2 {
public:
- operator char * () {
+ operator const char * () {
return "";
}
} a2;
} a3;
class A4 {
public:
- operator char * () {
+ operator const char * () {
return "";
}
operator unsigned long long int () {
// { dg-do assemble }
-char *a="aê";
+const char *a="aê";
class A
{
public:
A()
{
- char *b="aê";
+ const char *b="aê";
}
};
-char *c="aê";
+const char *c="aê";
}
void
-abort_because (char *str)
+abort_because (const char *str)
{
printf ("aborting because %s\n", str);
abort ();
class call_trace {
public:
- call_trace(char* fcn_name);
+ call_trace(const char* fcn_name);
~call_trace();
};
extern "C" void prt();
char * smt_mark_stree() {
- char* _my_name = "smt_mark_stree" ;
+ const char* _my_name = "smt_mark_stree" ;
call_trace _t(_my_name);
return last_tree = 0 ? (char*)0 : (prt(), (char*)0);
boolean Func2(String30 StrParI1, String30 StrParI2);
boolean Func3(Enumeration EnumParIn);
-void mystrcpy(String30 s, char* t)
+void mystrcpy(String30 s, const char* t)
{
for (; *t != '\0'; ++s, ++t) *s = *t;
*s = '\0';
char *
X::stringify() const // { dg-error "does not match" }
{
- return "stringify";
+ return "stringify"; // { dg-warning "deprecated" }
}
const char *
// to fall over.
struct A {
- char *name;
+ const char *name;
int reserved;
int a;
int b;
public:
inline ShBop(const ShBe* theBe);
void shWw(bool,
- char* a1 = "",
- char* a2 = "",
+ const char* a1 = "",
+ const char* a2 = "",
int a3 = -1,
- char* a4 = "foo");
+ const char* a4 = "foo");
typedef enum { shOk,
shFailed,
shDone,
#include <iostream>
-std::ostream& foo (char *x, std::ostream &y)
+std::ostream& foo (const char *x, std::ostream &y)
{
return y << "" << x;
}
void baz()
{
- foo<char*>(3.0, "abc");
- foo<char*, double>("abc", 3.0);
+ foo<const char*>(3.0, "abc");
+ foo<const char*, double>("abc", 3.0);
}
struct B { struct A { A(); int a; } aa; };
B::A::A () { a = 37; }
-char* xx[] = {
+const char* xx[] = {
"../tests/m6.cc:1: warning: return type specification for constructor invalid",
"../tests/m6.cc:2: semicolon missing after declaration of `A'",
"../tests/m6.cc:2: warning: empty declaration",
struct B { struct A { A(); int a; }; A aa; };
B::A::A () { a = 37; }
-char *xx[]= {"/*",
+const char *xx[]= {"/*",
"../tests/m7.cc:1: warning: return type specification for constructor invalid",
"../tests/m7.cc: In function struct A A ():",
"../tests/m7.cc:2: `a' undeclared (first use this function)",
template <const E* ep>
struct S1
{
- static char* s;
+ static const char* s;
};
template <int D>
E S2<1>::es[1] = {e};
template <>
-char* S1<S2<1>::es>::s = "abc";
+const char* S1<S2<1>::es>::s = "abc";
}
static int x[10];
- frob<char> fc ("hello");
+ frob<const char> fc ("hello");
frob<int> fi (x);
int main () {
// { dg-options "-O2 -fPIC " }
struct T
{
- char* f1;
+ const char* f1;
int f2;
};
template <class T, int n, class U> struct A {
A() {}
- A(char*) {}
+ A(const char*) {}
};
void f1()