Crank up the warning levels, and adjust the code to silence ...

several compilers:
- gcc version 4.5.3 (NetBSD nb2 20110806)
- gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
- Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)

The warnings were mostly about local variables shadowing others,
unused function parameters, and C++ style comments. Some variables were
indeed used before set.

Note that on Linux, using -std=c99 does stupid things like *remove* the
declaration of strdup() from <string.h>. Therefore I've reluctantly used
-std=gnu99.
This commit is contained in:
Olaf Seibert
2015-05-27 21:51:26 +02:00
parent 8a2ba3adf0
commit d38f4009c4
17 changed files with 133 additions and 110 deletions

View File

@@ -1,4 +1,10 @@
CFLAGS ?= -O -g
#####
#
# Makefile for macro11 and dumpobj
#
WARNS ?= -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow
CFLAGS ?= -O -ggdb -std=gnu99 $(WARNS)
MACRO11_SRCS = macro11.c \
assemble.c assemble_globals.c assemble_aux.c \

View File

@@ -182,23 +182,23 @@ static int assemble(
if (strcmp(label, ".") == 0) {
if (current_pc->section->flags & PSECT_REL) {
SYMBOL *sym;
SYMBOL *symb;
unsigned offset;
/* Express the given expression as a symbol and an
offset. The symbol must not be global, the
section must = current. */
if (!express_sym_offset(value, &sym, &offset)) {
if (!express_sym_offset(value, &symb, &offset)) {
report(stack->top, "Illegal ORG\n");
} else if ((sym->flags & (SYMBOLFLAG_GLOBAL | SYMBOLFLAG_DEFINITION)) == SYMBOLFLAG_GLOBAL) {
} else if ((symb->flags & (SYMBOLFLAG_GLOBAL | SYMBOLFLAG_DEFINITION)) == SYMBOLFLAG_GLOBAL) {
report(stack->top, "Can't ORG to external location\n");
} else if (sym->flags & SYMBOLFLAG_UNDEFINED) {
} else if (symb->flags & SYMBOLFLAG_UNDEFINED) {
report(stack->top, "Can't ORG to undefined sym\n");
} else if (sym->section != current_pc->section) {
} else if (symb->section != current_pc->section) {
report(stack->top, "Can't ORG to alternate section " "(use PSECT)\n");
} else {
DOT = sym->value + offset;
DOT = symb->value + offset;
list_value(stack->top, DOT);
change_dot(tr, 0);
}
@@ -379,9 +379,9 @@ static int assemble(
{
STREAM *str;
MACRO_STREAM *mstr;
int local;
int islocal;
label = get_symbol(cp, &cp, &local);
label = get_symbol(cp, &cp, &islocal);
if (label == NULL) {
report(stack->top, "Bad .NARG syntax\n");
@@ -401,7 +401,7 @@ static int assemble(
mstr = (MACRO_STREAM *) str;
add_sym(label, mstr->nargs, SYMBOLFLAG_DEFINITION | local, &absolute_section,
add_sym(label, mstr->nargs, SYMBOLFLAG_DEFINITION | islocal, &absolute_section,
&symbol_st);
free(label);
list_value(stack->top, mstr->nargs);
@@ -411,9 +411,9 @@ static int assemble(
case P_NCHR:
{
char *string;
int local;
int islocal;
label = get_symbol(cp, &cp, &local);
label = get_symbol(cp, &cp, &islocal);
if (label == NULL) {
report(stack->top, "Bad .NCHR syntax\n");
@@ -424,7 +424,7 @@ static int assemble(
string = getstring(cp, &cp);
add_sym(label, strlen(string), SYMBOLFLAG_DEFINITION | local, &absolute_section,
add_sym(label, strlen(string), SYMBOLFLAG_DEFINITION | islocal, &absolute_section,
&symbol_st);
free(label);
free(string);
@@ -434,9 +434,9 @@ static int assemble(
case P_NTYPE:
{
ADDR_MODE mode;
int local;
int islocal;
label = get_symbol(cp, &cp, &local);
label = get_symbol(cp, &cp, &islocal);
if (label == NULL) {
report(stack->top, "Bad .NTYPE syntax\n");
return 0;
@@ -450,7 +450,7 @@ static int assemble(
return 0;
}
add_sym(label, mode.type, SYMBOLFLAG_DEFINITION | local, &absolute_section, &symbol_st);
add_sym(label, mode.type, SYMBOLFLAG_DEFINITION | islocal, &absolute_section, &symbol_st);
free_addr_mode(&mode);
free(label);
@@ -760,8 +760,6 @@ static int assemble(
free_tree(value);
} else if (strcmp(label, "B") == 0 ||
strcmp(label, "NB") == 0) {
char *thing;
cp = skipwhite(cp);
if (EOL(*cp)) {
ok = 1;
@@ -805,28 +803,28 @@ static int assemble(
} else {
int sword;
unsigned uword;
EX_TREE *value = parse_expr(cp, 0);
EX_TREE *tvalue = parse_expr(cp, 0);
cp = value->cp;
cp = tvalue->cp;
if (value->type != EX_LIT) {
if (tvalue->type != EX_LIT) {
report(stack->top, "Bad .IF expression\n");
list_value(stack->top, 0);
free_tree(value);
free_tree(tvalue);
ok = FALSE; /* Pick something. */
} else {
unsigned word;
unsigned word = 0;
/* Convert to signed and unsigned words */
sword = value->data.lit & 0x7fff;
sword = tvalue->data.lit & 0x7fff;
/* FIXME I don't know if the following
is portable enough. */
if (value->data.lit & 0x8000)
if (tvalue->data.lit & 0x8000)
sword |= ~0xFFFF; /* Render negative */
/* Reduce unsigned value to 16 bits */
uword = value->data.lit & 0xffff;
uword = tvalue->data.lit & 0xffff;
if (strcmp(label, "EQ") == 0 || strcmp(label, "Z") == 0)
ok = (uword == 0), word = uword;
@@ -840,10 +838,12 @@ static int assemble(
ok = (sword < 0), word = sword;
else if (strcmp(label, "LE") == 0)
ok = (sword <= 0), word = sword;
else
ok = 0, word = 0;
list_value(stack->top, word);
free_tree(value);
free_tree(tvalue);
}
}
@@ -936,7 +936,7 @@ static int assemble(
{
SYMBOL *sectsym;
SECTION *sect;
unsigned int old_flags = ~0;
unsigned int old_flags = ~0u;
int unnamed_csect = 0;
label = get_symbol(cp, &cp, NULL);
@@ -1019,7 +1019,7 @@ static int assemble(
* first time.
* See page 6-38 of AA-KX10A-TC_PDP-11_MACRO-11_Reference_Manual_May88.pdf .
*/
if (old_flags != ~0 && sect->flags != old_flags) {
if (old_flags != ~0u && sect->flags != old_flags) {
/* The manual also says that any different
* flags are ignored, and an error issued.
* Apparently, that isn't true.
@@ -1535,7 +1535,6 @@ static int assemble(
EX_TREE *value;
unsigned reg;
unsigned word;
int ok = 1;
value = parse_expr(cp, 0);
cp = value->cp;
@@ -1544,7 +1543,6 @@ static int assemble(
if (reg == NO_REG || reg > 4) {
report(stack->top, "Illegal source register\n");
reg = 0;
ok = 0;
}
cp = skipwhite(cp);

View File

@@ -209,11 +209,9 @@ void implicit_gbl(
switch (value->type) {
case EX_UNDEFINED_SYM:
{
SYMBOL *sym;
if (!(value->data.symbol->flags & SYMBOLFLAG_LOCAL)) { /* Unless it's a
local symbol, */
sym = add_sym(value->data.symbol->label, 0, SYMBOLFLAG_GLOBAL, &absolute_section, &implicit_st);
add_sym(value->data.symbol->label, 0, SYMBOLFLAG_GLOBAL, &absolute_section, &implicit_st);
}
}
break;
@@ -587,6 +585,8 @@ void go_section(
TEXT_RLD *tr,
SECTION *sect)
{
(void)tr;
if (current_pc->section == sect)
return; /* This is too easy */
@@ -756,13 +756,13 @@ void write_globals(
if (xfer_address->type == EX_LIT) {
gsd_xfer(&gsd, ". ABS.", xfer_address->data.lit);
} else {
SYMBOL *sym;
SYMBOL *lsym;
unsigned offset;
if (!express_sym_offset(xfer_address, &sym, &offset)) {
if (!express_sym_offset(xfer_address, &lsym, &offset)) {
report(NULL, "Illegal program transfer address\n");
} else {
gsd_xfer(&gsd, sym->section->label, sym->value + offset);
gsd_xfer(&gsd, lsym->section->label, lsym->value + offset);
}
}

View File

@@ -65,20 +65,20 @@ SECTION *last_dot_section; /* ...and it's program section */
the assembler: */
SECTION register_section = {
"", SECTION_REGISTER, 0, 0
"", SECTION_REGISTER, 0, 0, 0, 0
}; /* the section containing the registers */
SECTION pseudo_section = {
"", SECTION_PSEUDO, 0, 0
"", SECTION_PSEUDO, 0, 0, 0, 0
}; /* the section containing the
pseudo-operations */
SECTION instruction_section = {
". ABS.", SECTION_INSTRUCTION, 0, 0
". ABS.", SECTION_INSTRUCTION, 0, 0, 0, 0
}; /* the section containing instructions */
SECTION macro_section = {
"", SECTION_SYSTEM, 0, 0, 0
"", SECTION_SYSTEM, 0, 0, 0, 0
}; /* Section for macros */
/* These are real psects that get written out to the object file */

View File

@@ -6,8 +6,6 @@
#include "mlb.h"
#include "symbols.h"
#include "extree.h"
//#include "stream2.h"
//#include "object.h"

View File

@@ -72,7 +72,7 @@ char *readrec(
if (c != 1) {
fprintf(stderr, "Improperly formatted OBJ file (1)\n");
return NULL; // Not a properly formatted file.
return NULL; /* Not a properly formatted file. */
}
chksum -= c;
@@ -80,10 +80,10 @@ char *readrec(
c = fgetc(fp);
if (c != 0) {
fprintf(stderr, "Improperly formatted OBJ file (2)\n");
return NULL; // Not properly formatted
return NULL; /* Not properly formatted */
}
chksum -= c; // even though for 0 the checksum isn't changed...
chksum -= c; /* even though for 0 the checksum isn't changed... */
#endif /* RT11 */
c = fgetc(fp);
@@ -108,7 +108,7 @@ char *readrec(
chksum -= c;
#if RT11
*len -= 4; // Subtract header and length bytes from length
*len -= 4; /* Subtract header and length bytes from length */
#endif
if (*len < 0) {
fprintf(stderr, "Improperly formatted OBJ file (5)\n");
@@ -118,7 +118,7 @@ char *readrec(
buf = malloc(*len);
if (buf == NULL) {
fprintf(stderr, "Out of memory allocating %d bytes\n", *len);
return NULL; // Bad alloc
return NULL; /* Bad alloc */
}
i = fread(buf, 1, *len, fp);
@@ -403,6 +403,9 @@ void got_endgsd(
{
int i;
(void)cp;
(void)len;
qsort(all_gsds, nr_gsds, sizeof(char *), compare_gsdlines);
printf("GSD:\n");
@@ -530,7 +533,7 @@ void got_rld(
case 014:
rad50name(cp + i + 2, name);
printf("\tPSECT displaced%s %o=%s+%o\n", byte, addr, name, word);
printf("\tPSECT displaced%s %o=%s\n", byte, addr, name);
i += 6;
badbin = 1;
break;
@@ -633,6 +636,7 @@ void got_isd(
char *cp,
int len)
{
(void)cp;
printf("ISD len=%o\n", len);
}
@@ -640,6 +644,8 @@ void got_endmod(
char *cp,
int len)
{
(void)cp;
(void)len;
printf("ENDMOD\n");
}
@@ -647,6 +653,8 @@ void got_libhdr(
char *cp,
int len)
{
(void)cp;
(void)len;
printf("LIBHDR\n");
}
@@ -654,6 +662,8 @@ void got_libend(
char *cp,
int len)
{
(void)cp;
(void)len;
printf("LIBEND\n");
}
@@ -665,10 +675,15 @@ int main(
FILE *fp;
char *cp;
if (argc < 2) {
fprintf(stderr, "Usage: dumpobj input.obj [ output.obj ]\n");
exit(1);
}
fp = fopen(argv[1], "rb");
if (fp == NULL)
return EXIT_FAILURE;
if (argv[2]) {
if (argc > 2 && argv[2]) {
bin = fopen(argv[2], "wb");
if (bin == NULL)
return EXIT_FAILURE;

View File

@@ -724,6 +724,9 @@ EX_TREE *evaluate(
res->data.child.right = right;
}
break;
default:
fprintf(stderr, "Invalid tree\n");
return NULL;
}
res->cp = cp;

View File

@@ -31,8 +31,6 @@ extern int list_bex; /* option to show binary */
extern int list_level; /* Listing control level. .LIST
increments; .NLIST decrements */
//extern char *listline; /* Source lines */
extern FILE *lstfile;
extern int list_pass_0; /* Also list what happens during the first pass */

View File

@@ -75,7 +75,7 @@ static void enable_tf(
list_md = tf;
}
//JH:
/*JH:*/
static void print_version(
FILE *strm)
{
@@ -178,14 +178,14 @@ int main(
/* Followed by options to enable */
/* Since /SHOW and /ENABL option names don't overlap,
I consolidate. */
if(arg >= argc-1 || !isalpha(*argv[arg+1])) {
if(arg >= argc-1 || !isalpha((unsigned char)*argv[arg+1])) {
usage("-e must be followed by an option to enable\n");
}
upcase(argv[++arg]);
enable_tf(argv[arg], 1);
} else if (!stricmp(cp, "d")) {
/* Followed by an option to disable */
if(arg >= argc-1 || !isalpha(*argv[arg+1])) {
if(arg >= argc-1 || !isalpha((unsigned char)*argv[arg+1])) {
usage("-d must be followed by an option to disable\n");
}
upcase(argv[++arg]);
@@ -253,13 +253,13 @@ int main(
into individual .MAC files in the current
directory. No assembly of input is done. This
must be the last command line option. */
int i;
int m;
if(arg != argc-1) {
usage("-x must be the last option\n");
}
for (i = 0; i < nr_mlbs; i++)
mlb_extract(mlbs[i]);
for (m = 0; m < nr_mlbs; m++)
mlb_extract(mlbs[m]);
return EXIT_SUCCESS;
} else if (!stricmp(cp, "ysl")) {
/* set symbol_len */

View File

@@ -2,8 +2,8 @@
#define MACRO11_H
#define VERSIONSTR "0.4wip (22 May 2015)"
//#define VERSIONSTR "0.3 (April 21, 2009)"
//#define VERSIONSTR "0.2 July 15, 2001"
/*#define VERSIONSTR "0.3 (April 21, 2009)" */
/*#define VERSIONSTR "0.2 July 15, 2001" */
/*

View File

@@ -338,7 +338,7 @@ BUFFER *subst_args(
for (begin = in = text->buffer; in < text->buffer + text->length;) {
char *next;
if (issym(*in)) {
if (issym((unsigned char)*in)) {
label = get_symbol(in, &next, NULL);
if (label) {
if ((arg = find_arg(args, label))) {

View File

@@ -163,7 +163,7 @@ static int gsd_write(
char *cp;
unsigned radtbl[2];
if (gsd->offset > sizeof(gsd->buf) - 8) {
if (gsd->offset > (int)sizeof(gsd->buf) - 8) {
if (!gsd_flush(gsd))
return 0;
}
@@ -220,6 +220,10 @@ int gsd_xfer(
char *name,
unsigned value)
{
/*
* MACRO V05.05 uses 050 as flags.
* The Task Builder Manual shows them to be 0.
*/
return gsd_write(gsd, name, 010, GSD_XFER, value);
}
@@ -328,8 +332,9 @@ static int text_fit(
int txtsize,
int rldsize)
{
if (tr->txt_offset + txtsize <= sizeof(tr->text) && tr->rld_offset + rldsize <= sizeof(tr->rld)
&& (txtsize == 0 || tr->txt_addr + tr->txt_offset - 4 == addr))
if (tr->txt_offset + txtsize <= (int)sizeof(tr->text) &&
tr->rld_offset + rldsize <= (int)sizeof(tr->rld) &&
(txtsize == 0 || tr->txt_addr + tr->txt_offset - 4 == addr))
return 1; /* All's well. */
if (!text_flush(tr))
@@ -792,7 +797,7 @@ static char *text_complex_fit(
{
int len;
if (tx->len + size > sizeof(tx->accum))
if (tx->len + size > (int)sizeof(tx->accum))
return NULL; /* Expression has grown too complex. */
len = tx->len;

40
parse.c
View File

@@ -99,7 +99,7 @@ char *getstring_fn(
return NULL;
}
if (!ispunct(*cp)) {
if (!ispunct((unsigned char)*cp)) {
return NULL;
}
@@ -339,7 +339,7 @@ int parse_float(
int i; /* Number of fields converted by sscanf */
int n; /* Number of characters converted by sscanf */
int sexp; /* Signed exponent */
unsigned exp; /* Unsigned excess-128 exponent */
unsigned uexp; /* Unsigned excess-128 exponent */
unsigned sign = 0; /* Sign mask */
i = sscanf(cp, "%lf%n", &d, &n);
@@ -359,8 +359,8 @@ int parse_float(
if (sexp < -128 || sexp > 127)
return 0; /* Exponent out of range. */
exp = sexp + 128; /* Make excess-128 mode */
exp &= 0xff; /* express in 8 bits */
uexp = sexp + 128; /* Make excess-128 mode */
uexp &= 0xff; /* express in 8 bits */
if (frac < 0) {
sign = 0100000; /* Negative sign */
@@ -377,11 +377,11 @@ int parse_float(
if (ufrac > 0x200000000000) { /* Overflow? */
ufrac >>= 1; /* Normalize */
exp--;
uexp--;
}
}
flt[0] = (unsigned) (sign | (exp << 7) | ((ufrac >> 48) & 0x7F));
flt[0] = (unsigned) (sign | (uexp << 7) | ((ufrac >> 48) & 0x7F));
if (size > 1) {
flt[1] = (unsigned) ((ufrac >> 32) & 0xffff);
if (size > 2) {
@@ -530,15 +530,15 @@ char *get_symbol(
cp = skipwhite(cp); /* Skip leading whitespace */
if (!issym(*cp))
if (!issym((unsigned char)*cp))
return NULL;
digits = 0;
if (isdigit(*cp))
if (isdigit((unsigned char)*cp))
digits = 2; /* Think about digit count */
for (symcp = cp + 1; issym(*symcp); symcp++) {
if (!isdigit(*symcp)) /* Not a digit? */
for (symcp = cp + 1; issym((unsigned char)*symcp); symcp++) {
if (!isdigit((unsigned char)*symcp)) /* Not a digit? */
digits--; /* Make a note. */
}
@@ -569,15 +569,15 @@ char *get_symbol(
char *newsym = memcheck(malloc(32)); /* Overkill */
sprintf(newsym, "%ld$%d", strtol(symcp, NULL, 10), lsb);
if (enabl_debug && lstfile) {
fprintf(lstfile, "lsb %d: %s -> %s\n",
lsb, symcp, newsym);
}
if (enabl_debug && lstfile) {
fprintf(lstfile, "lsb %d: %s -> %s\n",
lsb, symcp, newsym);
}
free(symcp);
symcp = newsym;
if (islocal)
*islocal = SYMBOLFLAG_LOCAL;
lsb_used++;
lsb_used++;
} else {
free(symcp);
return NULL;
@@ -585,7 +585,7 @@ char *get_symbol(
}
} else {
/* disallow local label format */
if (isdigit(*symcp)) {
if (isdigit((unsigned char)*symcp)) {
free(symcp);
return NULL;
}
@@ -708,7 +708,7 @@ EX_TREE *parse_unary(
if (*cp == '^') {
int save_radix;
switch (tolower(cp[1])) {
switch (tolower((unsigned char)cp[1])) {
case 'c':
/* ^C, ones complement */
tp = new_ex_tree();
@@ -775,7 +775,7 @@ EX_TREE *parse_unary(
}
}
if (ispunct(cp[1])) {
if (ispunct((unsigned char)cp[1])) {
char *ecp;
/* oddly-bracketed expression like this: ^/expression/ */
@@ -827,7 +827,7 @@ EX_TREE *parse_unary(
/* Numeric constants are trickier than they need to be, */
/* since local labels start with a digit too. */
if (isdigit(*cp)) {
if (isdigit((unsigned char)*cp)) {
char *label;
int local;
@@ -840,7 +840,7 @@ EX_TREE *parse_unary(
local label. */
/* Look for a trailing period, to indicate decimal... */
for (endcp = cp; isdigit(*endcp); endcp++) ;
for (endcp = cp; isdigit((unsigned char)*endcp); endcp++) ;
if (*endcp == '.')
rad = 10;

View File

@@ -59,7 +59,7 @@ unsigned rad50(
if (!*cp) /* Got to check for end-of-string manually, because strchr will call it a hit. :-/ */
return acc;
rp = strchr(radtbl, toupper(*cp));
rp = strchr(radtbl, toupper((unsigned char)*cp));
if (rp == NULL) /* Not a RAD50 character */
return acc;
acc = ((int) (rp - radtbl)) * 03100; /* Convert */
@@ -71,7 +71,7 @@ unsigned rad50(
*endp = cp;
if (!*cp)
return acc;
rp = strchr(radtbl, toupper(*cp));
rp = strchr(radtbl, toupper((unsigned char)*cp));
if (rp == NULL)
return acc;
acc += ((int) (rp - radtbl)) * 050;
@@ -81,7 +81,7 @@ unsigned rad50(
*endp = cp;
if (!*cp)
return acc;
rp = strchr(radtbl, toupper(*cp));
rp = strchr(radtbl, toupper((unsigned char)*cp));
if (rp == NULL)
return acc;
acc += (int) (rp - radtbl);

View File

@@ -42,48 +42,48 @@ struct stream;
typedef struct stream_vtbl {
void (
*delete) (
struct stream * stream); // Destructor
struct stream * stream); /* Destructor */
char *(
*gets) (
struct stream * stream); // "gets" function
struct stream * stream); /* "gets" function */
void (
*rewind) (
struct stream * stream); // "rewind" function
struct stream * stream); /* "rewind" function */
} STREAM_VTBL;
typedef struct stream {
STREAM_VTBL *vtbl; // Pointer to dispatch table
char *name; // Stream name
int line; // Current line number in stream
struct stream *next; // Next stream in stack
STREAM_VTBL *vtbl; /* Pointer to dispatch table */
char *name; /* Stream name */
int line; /* Current line number in stream */
struct stream *next; /* Next stream in stack */
} STREAM;
typedef struct file_stream {
STREAM stream; // Base class
FILE *fp; // File pointer
char *buffer; // Line buffer
STREAM stream; /* Base class */
FILE *fp; /* File pointer */
char *buffer; /* Line buffer */
} FILE_STREAM;
typedef struct buffer {
char *buffer; // Pointer to text
int size; // Size of buffer
int length; // Occupied size of buffer
int use; // Number of users of buffer
char *buffer; /* Pointer to text */
int size; /* Size of buffer */
int length; /* Occupied size of buffer */
int use; /* Number of users of buffer */
} BUFFER;
#define GROWBUF_INCR 1024 // Buffers grow by leaps and bounds
#define GROWBUF_INCR 1024 /* Buffers grow by leaps and bounds */
typedef struct buffer_stream {
STREAM stream; // Base class
BUFFER *buffer; // text buffer
int offset; // Current read offset
STREAM stream; /* Base class */
BUFFER *buffer; /* text buffer */
int offset; /* Current read offset */
} BUFFER_STREAM;
typedef struct stack {
STREAM *top; // Top of stacked stream pieces
STREAM *top; /* Top of stacked stream pieces */
} STACK;
#define STREAM_BUFFER_SIZE 1024 // This limits the max size of an input line.
#define STREAM_BUFFER_SIZE 1024 /* This limits the max size of an input line. */
BUFFER *new_buffer(
void);
BUFFER *buffer_clone(

View File

@@ -191,7 +191,7 @@ SYMBOL *add_sym(
SYMBOL *sym;
char label[SYMMAX_MAX + 1]; // big size
if (isdigit(labelraw[0])) {
if (isdigit((unsigned char)labelraw[0])) {
// Don't truncate local labels
strncpy(label, labelraw, SYMMAX_MAX);
label[SYMMAX_MAX] = 0;

2
util.c
View File

@@ -210,7 +210,7 @@ void upcase(
char *str)
{
while (*str) {
*str = toupper(*str);
*str = toupper((unsigned char)*str);
str++;
}
}