extern2.cc (foo): Declare as of type cost char*.

* 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
This commit is contained in:
Gabriel Dos Reis 2006-02-05 09:21:29 +00:00 committed by Gabriel Dos Reis
parent 9bf820df85
commit 7235a4d415
45 changed files with 136 additions and 74 deletions

View file

@ -1,3 +1,65 @@
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

View file

@ -2,4 +2,4 @@
/* { dg-do compile }
{ dg-require-iconv "IBM1047" }
{ dg-final { scan-assembler-not "foobar" } } */
extern "C" { char *foo = "foobar"; }
extern "C" { const char* foo = "foobar"; }

View file

@ -2,4 +2,4 @@
/* { dg-do compile }
{ dg-require-iconv "IBM1047" }
{ dg-final { scan-assembler-not "string foobar" } } */
char *foo = "string foobar";
const char* foo = "string foobar";

View file

@ -5,6 +5,6 @@
// { 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"); }

View file

@ -6,7 +6,7 @@
// { 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; }

View file

@ -1,6 +1,6 @@
// PR c++/9782
extern "C" void printf(char *, ...);
extern "C" void printf(const char*, ...);
template <int>
struct A {

View file

@ -20,7 +20,7 @@ A::strcmp (const char *s, const char *t)
}
int
foo (char *x) throw ()
foo (const char *x) throw ()
{
return A::strcmp ("", x);
}

View file

@ -20,7 +20,7 @@ A::strcmp (const char *s, const char *t) throw ()
}
int
foo (char *x) throw ()
foo (const char *x) throw ()
{
return A::strcmp ("", x);
}

View file

@ -16,7 +16,7 @@ A::strcmp (const char *s, const char *t)
}
int
foo (char *x)
foo (const char *x)
{
return A::strcmp ("", x);
}

View file

@ -10,7 +10,7 @@ struct C
{
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

View file

@ -1,4 +1,4 @@
int temp(char *temp);
int temp(const char *temp);
template <int> int g() { return temp("Hi"); }
int g1() { return temp("Hi"); }

View file

@ -93,7 +93,7 @@ ulong memsize;
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)
{

View file

@ -12,7 +12,7 @@ public:
typedef int (PTcl::*InterpFuncP)(int,char**);
struct InterpTableEntry {
char* name;
const char* name;
InterpFuncP func;
};

View file

@ -17,7 +17,7 @@ public:
typedef int (PTcl::*InterpFuncP)(int,char**);
struct InterpTableEntry {
char* name;
const char* name;
InterpFuncP func;
};

View file

@ -15,7 +15,7 @@ class bar
{
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

View file

@ -8,7 +8,7 @@ extern "C" int printf (const char *, ...);
class Y
{
public:
Y(char*) {}
Y(const char*) {}
Y& operator = (const Y&) { return *this; }
};
@ -16,7 +16,7 @@ public:
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.

View file

@ -1,5 +1,5 @@
// { dg-do run }
void f (char *const &) { }
void f (const char *const &) { }
int main ()
{
f ("hi");

View file

@ -21,14 +21,14 @@ struct A
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))
{

View file

@ -1,4 +1,4 @@
// { 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" };

View file

@ -48,5 +48,5 @@ Class1 :: Class1 (const String & constStringRef)
int main(void)
{
Class1 *class1 = new Class1("Hi!");
Class1 *class1 = new Class1((char*) "Hi!");
}

View file

@ -4,7 +4,7 @@
class A {
public:
typedef char * Ptr;
typedef const char * Ptr;
Ptr s;
Ptr get_string();
A(Ptr string); // { s = string; };

View file

@ -11,7 +11,7 @@
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()
{

View file

@ -8,7 +8,7 @@
class base_t {
public:
virtual char *name () { return "base_t"; }
virtual const char* name () { return "base_t"; }
base_t ();
virtual ~base_t ();
@ -16,7 +16,7 @@ public:
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.
@ -27,7 +27,7 @@ public:
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 ();

View file

@ -8,7 +8,7 @@ class bla {
public:
inline bla(char * jim) { ; };
inline bla(const char * jim) { ; };
inline ~bla() { destruct++; if (destruct == 2) printf ("PASS\n");};
};

View file

@ -10,13 +10,13 @@ class BUG1
{
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;
}

View file

@ -10,13 +10,13 @@
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;
}
@ -29,7 +29,7 @@ void C::count (int& total) {
}
}
char * foo[] = {
const char * foo[] = {
"one", "two", "three", NULL};
int main() {

View file

@ -10,7 +10,7 @@ typedef enum { BADBINOP = 0, PLUS, MINUS, MULT, DIV, POWR } binoptype;
typedef enum { BADUNOP = 0, NEG = POWR+1, SIN, COS, TAN } unoptype;
typedef struct {
char *s;
const char *s;
union {
binoptype bop;
unoptype uop;

View file

@ -7,20 +7,20 @@
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
@ -33,7 +33,7 @@ friend void derived_friend();
public :
void test(char * n) { base_publ(n); base_prot(n);}
void test(const char * n) { base_publ(n); base_prot(n);}
}; // class derived

View file

@ -7,20 +7,20 @@
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
@ -33,7 +33,7 @@ friend void derived_friend();
public :
void test(char * n) { base_publ(n); base_prot(n);}
void test(const char * n) { base_publ(n); base_prot(n);}
}; // class derived

View file

@ -14,7 +14,7 @@ public:
} a1;
class A2 {
public:
operator char * () {
operator const char * () {
return "";
}
} a2;
@ -26,7 +26,7 @@ public:
} a3;
class A4 {
public:
operator char * () {
operator const char * () {
return "";
}
operator unsigned long long int () {

View file

@ -1,14 +1,14 @@
// { dg-do assemble }
char *a="";
const char *a="";
class A
{
public:
A()
{
char *b="";
const char *b="";
}
};
char *c="";
const char *c="";

View file

@ -90,7 +90,7 @@ foo_parm_returns_foo (foo f)
}
void
abort_because (char *str)
abort_because (const char *str)
{
printf ("aborting because %s\n", str);
abort ();

View file

@ -3,7 +3,7 @@
class call_trace {
public:
call_trace(char* fcn_name);
call_trace(const char* fcn_name);
~call_trace();
};
@ -11,7 +11,7 @@ static char * last_tree;
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);

View file

@ -2097,7 +2097,7 @@ Enumeration Func1(CapitalLetter CharPar1, CapitalLetter CharPar2);
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';

View file

@ -525,7 +525,7 @@ public:
char *
X::stringify() const // { dg-error "does not match" }
{
return "stringify";
return "stringify"; // { dg-warning "deprecated" }
}
const char *

View file

@ -7,7 +7,7 @@
// to fall over.
struct A {
char *name;
const char *name;
int reserved;
int a;
int b;

View file

@ -62,10 +62,10 @@ class ShBop
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,

View file

@ -3,7 +3,7 @@
#include <iostream>
std::ostream& foo (char *x, std::ostream &y)
std::ostream& foo (const char *x, std::ostream &y)
{
return y << "" << x;
}

View file

@ -8,6 +8,6 @@ void foo(double, U) {}
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);
}

View file

@ -2,7 +2,7 @@
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",

View file

@ -2,7 +2,7 @@
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)",

View file

@ -5,7 +5,7 @@ enum E { e };
template <const E* ep>
struct S1
{
static char* s;
static const char* s;
};
template <int D>
@ -25,4 +25,4 @@ struct S3
E S2<1>::es[1] = {e};
template <>
char* S1<S2<1>::es>::s = "abc";
const char* S1<S2<1>::es>::s = "abc";

View file

@ -16,7 +16,7 @@ void frob<T>::print () {
}
static int x[10];
frob<char> fc ("hello");
frob<const char> fc ("hello");
frob<int> fi (x);
int main () {

View file

@ -2,7 +2,7 @@
// { dg-options "-O2 -fPIC " }
struct T
{
char* f1;
const char* f1;
int f2;
};

View file

@ -5,7 +5,7 @@ extern "C" void exit (int);
template <class T, int n, class U> struct A {
A() {}
A(char*) {}
A(const char*) {}
};
void f1()