Warning fixes for Sparc32, Sparc64, PPC

Fix warnings that would be caused by gcc flag -Wwrite-strings and
-Wmissing-prototypes. Also fix most PPC specific warnings.


git-svn-id: svn://coreboot.org/openbios/openbios-devel@288 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-12-14 12:54:23 +00:00
parent bb20ce577c
commit c5d270009e
17 changed files with 54 additions and 48 deletions

View File

@@ -28,8 +28,6 @@
#define MEMORY_SIZE (256*1024) /* 256K ram for hosted system */
#define DICTIONARY_SIZE (512*1024) /* 128K for the dictionary */
extern unsigned char *dict;
extern cell dicthead;
static ucell *memory;
/************************************************************************/

View File

@@ -87,7 +87,7 @@ entry( void )
}
static void
setenv( char *env, char *value )
setenv( const char *env, const char *value )
{
push_str( value );
push_str( env );
@@ -97,7 +97,7 @@ setenv( char *env, char *value )
void
arch_of_init( void )
{
#if USE_RTAS
#ifdef USE_RTAS
phandle_t ph;
#endif
int autoboot;
@@ -114,7 +114,7 @@ arch_of_init( void )
node_methods_init();
#if USE_RTAS
#ifdef USE_RTAS
if( !(ph=find_dev("/rtas")) )
printk("Warning: No /rtas node\n");
else {

View File

@@ -34,8 +34,8 @@ static void try_path(const char *path, char *param, const void *romvec)
void boot(void)
{
char *path = pop_fstr_copy(), *param, *oldpath = path;
char altpath[256];
char *path = pop_fstr_copy(), *param, altpath[256];
const char *oldpath = path;
int unit = 0;
const void *romvec;

View File

@@ -172,10 +172,10 @@ struct linux_romvec {
struct linux_nodeops {
int (*no_nextnode)(int node);
int (*no_child)(int node);
int (*no_proplen)(int node, char *name);
int (*no_getprop)(int node, char *name, char *val);
int (*no_setprop)(int node, char *name, char *val, int len);
const char * (*no_nextprop)(int node, char *name);
int (*no_proplen)(int node, const char *name);
int (*no_getprop)(int node, const char *name, char *val);
int (*no_setprop)(int node, const char *name, char *val, int len);
const char * (*no_nextprop)(int node, const char *name);
};
/* More fun PROM structures for device probing. */

View File

@@ -41,10 +41,10 @@ const char *obp_stdin_path, *obp_stdout_path;
static int obp_nextnode(int node);
static int obp_child(int node);
static int obp_proplen(int node, char *name);
static int obp_getprop(int node, char *name, char *val);
static int obp_setprop(int node, char *name, char *val, int len);
static const char *obp_nextprop(int node, char *name);
static int obp_proplen(int node, const char *name);
static int obp_getprop(int node, const char *name, char *val);
static int obp_setprop(int node, const char *name, char *val, int len);
static const char *obp_nextprop(int node, const char *name);
static int obp_devread(int dev_desc, char *buf, int nbytes);
static int obp_devseek(int dev_desc, int hi, int lo);
@@ -85,7 +85,7 @@ static int obp_child(int node)
return child;
}
static int obp_proplen(int node, char *name)
static int obp_proplen(int node, const char *name)
{
int notfound;
@@ -129,11 +129,11 @@ static int looks_like_string(char *str, int len)
}
#endif
static int obp_getprop(int node, char *name, char *value)
static int obp_getprop(int node, const char *name, char *value)
{
int notfound, found;
int len;
char *str;
const char *str;
if (!node) {
DPRINTF("obp_getprop(0x0, %s) = -1\n", name);
@@ -192,7 +192,7 @@ static int obp_getprop(int node, char *name, char *value)
}
}
static const char *obp_nextprop(int node, char *name)
static const char *obp_nextprop(int node, const char *name)
{
int found;
@@ -224,7 +224,7 @@ static const char *obp_nextprop(int node, char *name)
}
static int obp_setprop(__attribute__((unused)) int node,
__attribute__((unused)) char *name,
__attribute__((unused)) const char *name,
__attribute__((unused)) char *value,
__attribute__((unused)) int len)
{

View File

@@ -44,17 +44,17 @@ void boot(void)
} else {
switch (boot_device) {
case 'a':
path = "/obio/SUNW,fdtwo";
path = strdup("/obio/SUNW,fdtwo");
break;
case 'c':
path = "disk";
path = strdup("disk");
break;
default:
case 'd':
path = "cdrom";
path = strdup("cdrom");
break;
case 'n':
path = "net";
path = strdup("net");
break;
}
}

View File

@@ -41,7 +41,7 @@ struct esp_dma {
typedef struct sd_private {
unsigned int bs;
char *media_str;
const char *media_str;
uint32_t sectors;
uint8_t media;
uint8_t id;
@@ -182,7 +182,7 @@ read_capacity(esp_private_t *esp, sd_private_t *sd)
static unsigned int
inquiry(esp_private_t *esp, sd_private_t *sd)
{
char *media = "UNKNOWN";
const char *media = "UNKNOWN";
// Setup command = Inquiry
memset(esp->buffer, 0, 7);

View File

@@ -157,7 +157,7 @@ ob_ide_400ns_delay(struct ide_drive *drive)
}
static void
ob_ide_error(struct ide_drive *drive, unsigned char stat, char *msg)
ob_ide_error(struct ide_drive *drive, unsigned char stat, const char *msg)
{
struct ide_channel *chan = drive->channel;
unsigned char err;
@@ -1285,8 +1285,8 @@ int ob_ide_init(void)
{
int i, j;
char * nodetemp_chan = "/pci/isa/ide%d";
char * nodetemp = "/pci/isa/ide%d/%s";
const char *nodetemp_chan = "/pci/isa/ide%d";
const char *nodetemp = "/pci/isa/ide%d/%s";
char nodebuff[32];
phandle_t dnode;
@@ -1336,7 +1336,7 @@ int ob_ide_init(void)
printk("ide%d: [io ports 0x%x-0x%x,0x%x]\n", i, chan->io_regs[0], chan->io_regs[0] + 7, chan->io_regs[8]);
for (j = 0; j < 2; j++) {
struct ide_drive *drive = &chan->drives[j];
char *media = "UNKNOWN";
const char *media = "UNKNOWN";
if (!drive->present)
continue;

View File

@@ -342,9 +342,15 @@ next_dentry (xfs_ino_t *ino)
{
int namelen = 1;
int toread;
static char *usual[2] = {".", ".."};
static char *usual[2];
static xfs_dir2_sf_entry_t *sfe;
char *name = usual[0];
char *name;
if (!usual[0]) {
usual[0] = strdup(".");
usual[1] = strdup("..");
}
name = usual[0];
if (xfs.dirpos >= xfs.dirmax) {
if (xfs.forw == 0)

View File

@@ -47,7 +47,7 @@ void (*disk_read_func) (int, int, int);
/************************************************************************/
typedef struct fsys_entry {
char *name;
const char *name;
int (*mount_func) (void);
int (*read_func) (char *buf, int len);
int (*dir_func) (char *dirname);
@@ -221,7 +221,7 @@ close_fs( fs_ops_t *fs )
/* callers responsibility to call free(fs) */
}
static char *
static const char *
grubfs_get_fstype( fs_ops_t *fs )
{
grubfs_t *gfs = (grubfs_t*)fs->fs_data;

View File

@@ -67,7 +67,9 @@ search_files( record *par, int recursive, match_proc_t proc, const void *match_d
} while( ret && !record_next(&r) );
if( !ret && pt ) {
char name[256], *s2 = t.path ? t.path : "";
char name[256];
const char *s2 = t.path ? t.path : "";
unicode_uni2asc( name, &r.key.name, sizeof(name));
pt->rec = t.rec;
@@ -359,7 +361,7 @@ vol_name( fs_ops_t *fs, char *buf, int size )
return get_hfs_vol_name( fs->fd, buf, size );
}
static char *
static const char *
get_fstype( fs_ops_t *fs )
{
return ("HFS+");

View File

@@ -43,7 +43,7 @@ struct fs_ops {
int (*lseek)( file_desc_t *file, off_t offset, int whence );
char *(*get_path)( file_desc_t *file, char *buf, int len );
char *(*get_fstype)( fs_ops_t *fs );
const char *(*get_fstype)( fs_ops_t *fs );
};
extern fs_ops_t *fs_open( int fs_type, int fd );

View File

@@ -25,7 +25,7 @@ extern volatile int runforth;
extern int enterforth( xt_t xt );
extern void panic(const char *error) __attribute__ ((noreturn));
extern xt_t findword(char *s1);
extern xt_t findword(const char *s1);
extern void modules_init( void );
/* arch kernel hooks */

View File

@@ -53,7 +53,7 @@ unsigned long base_address;
/* include path handling */
typedef struct include_path include;
struct include_path {
char *path;
const char *path;
include *next;
};
@@ -137,7 +137,7 @@ static void relocation_table(unsigned char * dict_one, unsigned char *dict_two,
relocation_address=reloc_table;
}
static void write_dictionary(char *filename)
static void write_dictionary(const char *filename)
{
FILE *f;
unsigned char *write_data, *walk_data;
@@ -375,7 +375,7 @@ static void paddict(ucell align)
* generic forth word creator function.
*/
static void fcreate(char *word, ucell cfaval)
static void fcreate(const char *word, ucell cfaval)
{
if (strlen(word) == 0) {
printk("WARNING: tried to create unnamed word.\n");
@@ -395,20 +395,20 @@ static void fcreate(char *word, ucell cfaval)
}
static ucell *buildvariable(char *name, cell defval)
static ucell *buildvariable(const char *name, cell defval)
{
fcreate(name, DOVAR); /* see dict.h for DOVAR and other CFA ids */
writecell(defval);
return (ucell *) (dict + dicthead - sizeof(cell));
}
static void buildconstant(char *name, cell defval)
static void buildconstant(const char *name, cell defval)
{
fcreate(name, DOCON); /* see dict.h for DOCON and other CFA ids */
writecell(defval);
}
static void builddefer(char *name)
static void builddefer(const char *name)
{
fcreate(name, DODFR); /* see dict.h for DODFR and other CFA ids */
writecell((ucell)0);

View File

@@ -68,7 +68,7 @@ static int to_lower(int c)
/* fstrcmp - compare null terminated string with forth string. */
static int fstrcmp(char *s1, ucell fstr)
static int fstrcmp(const char *s1, ucell fstr)
{
char *s2 = (char*)cell2pointer(fstr);
while (*s1) {
@@ -84,7 +84,7 @@ static int fstrcmp(char *s1, ucell fstr)
* word.
*/
xt_t findword(char *s1)
xt_t findword(const char *s1)
{
ucell tmplfa, len;

View File

@@ -110,7 +110,7 @@ create_free_part( char *ptr, int size )
}
static int
create_nv_part( int signature, char *name, int size )
create_nv_part( int signature, const char *name, int size )
{
nvpart_t *p = NULL;
int fs;

View File

@@ -174,7 +174,7 @@ set_color( int ind, ulong color )
#ifdef CONFIG_MOL
if( video.fb.depth == 8 )
OSI_SetColor( ind, color );
#elif CONFIG_SPARC32
#elif defined(CONFIG_SPARC32)
if( video.fb.depth == 8 ) {
dac[0] = ind << 24;
dac[1] = ((color >> 16) & 0xff) << 24; // Red