Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
50
Добавлен:
14.04.2015
Размер:
1.37 Mб
Скачать

Keil Software — Cx51 Compiler User’s Guide

205

 

 

Warnings

Warnings produce information about potential problems which may occur during the execution of the resulting program. Warnings do not hinder compilation of the source file.

Warnings produce a message in the list file. These warning messages are in the following format:

*** WARNING number IN LINE line OF file: warning message

where:

 

number

is the error number.

line

corresponds to the line number in the source file or include

 

file.

file

is the name of the source or include file in which the error

 

was detected.

warning message is descriptive text that is dependent upon the type of warning encountered.

The following table lists warnings by number. The warning message displayed is listed along with a brief description and possible cause and correction.

Number Warning Message and Description

173Missing return-expression

A function which returns a value of any type but int, must contain a return statement including an expression. Because of compatibility to older programs, no check is done on functions which return an int value.

182

Pointer to different objects

 

 

A pointer was assigned the address of a different type.

7

 

 

185

Different memory space

 

The memory space of an object declaration differs from the memory space of a

 

prior declaration for the same object.

196Mspace probably invalid

This warning is caused by the assignment of an invalid constant value to a pointer. Valid pointer constants are long or unsigned long. The compiler uses 24 bits

(3 bytes) for pointer objects. The low-order 16 bits represent the offset. The high-order 8 bits represent the memory space selector.

198Sizeof returns zero

The calculation of the size of an object yields zero. This value may be wrong if the object is external or if not all dimension sizes of an array are known.

 

 

206

 

Chapter 7. Error Messages

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Number

Warning Message and Description

 

 

 

 

206

Missing function prototype

 

 

 

 

 

The called function is unknown because no prototype declaration exists. Calls to

 

 

 

 

 

unknown functions are always at risk that the number of parameters does not

 

 

 

 

 

correspond to the actual requirements. If this is the case, the function is called

 

 

 

 

 

incorrectly.

 

 

 

 

 

Without function prototypes, the compiler has no way to check for missing or

 

 

 

 

 

excessive parameters or their types. To avoid this warning, include prototypes of

 

 

 

 

 

the functions used in your program.

 

 

 

 

 

Function prototypes must be specified before the function is called. Note that

 

 

 

 

 

function definitions automatically produce prototypes.

 

 

 

 

209

Too few actual parameters

 

 

 

 

 

Too few actual parameters were included in a function call.

 

 

 

 

219

Long constant truncated to int

 

 

 

 

 

The value of a constant expression must be capable of being represented by an int

 

 

 

 

 

type.

 

 

 

 

245

Unknown pragma, line ignored

 

 

 

 

 

The #pragma statement is unknown, so the entire pragma line is ignored.

 

 

 

 

258

Mspace illegal on struct/union member

 

 

 

 

 

Mspace on parameter ignored

 

 

 

 

 

A member of a structure or a parameter may not contain the specification of a

 

 

 

 

 

memory type. The object to which the pointer refers may, however, contain a

 

 

 

 

 

memory type. For example:

 

 

 

 

 

struct vp { char code c; int xdata i; };

 

 

 

 

 

generates error 258.

 

 

 

 

 

struct v1 { char c; int xdata *i; };

 

 

 

 

 

is the correct declaration for the struct.

 

 

 

 

259

Pointer: different mspace

 

 

 

 

 

This warning is generated when two pointers that do not refer to the same memory

 

 

 

 

 

type of object are compared.

 

 

 

 

260

Pointer truncation

 

 

 

 

 

This error or warning occurs when converting a pointer to a pointer with a smaller

 

 

 

 

 

offset area. The conversion takes place, but the offset of the larger pointer is

 

 

 

 

 

truncated to fit into the smaller pointer.

 

7

 

 

 

 

 

261

Bit in reentrant function

 

 

 

 

A reentrant function cannot contain bits because bit scalars cannot be stored on

 

 

 

 

the virtual stack.

 

 

 

 

265

‘name’: recursive call to non-reentrant function

 

 

 

 

 

A direct recursion to a non-reentrant function was discovered. This can be

 

 

 

 

 

intentional but should be functionally checked (through the generated code) for

 

 

 

 

 

each individual case. Indirect recursions are discovered by the linker/locator.

 

Keil Software — Cx51 Compiler User’s Guide

207

 

 

 

 

 

 

 

 

 

 

 

Number

Warning Message and Description

 

 

 

 

 

 

 

271Misplaced ‘asm/endasm’ control

The asm and endasm statements may not be nested. Endasm requires that an asm block be opened by a previous asm statement. For example:

#pragma asm

.

.

.

assembler instruction(s)

.

.

.

#pragma endasm

275Expression with possibly no effect

The compiler detected an expression which does not generate code. For example:

void test

(void)

{

int i1,

i2, i3;

 

i1, i2,

i3;

/* dead expression */

i1 << 3;

 

/* result is not used */

}

 

 

276Constant in condition expression

The compiler detected a conditional expression with a constant value. In most cases this is a typing mistake. For example:

void test (void) { int i1, i2, i3;

if (i1 = 1) i2 = 3; /* const assigned with = */ while (i3 = 2); /* const assigned with = */

}

277Different mspaces to pointer

A typedef declaration has a conflict of the memory spaces. For example:

typedef

char xdata XCC;

/*

mspace

xdata */

typedef

XCC idata PICC;

/*

mspace

collision */

280Unreferenced symbol/label

This message identifies a symbol or label which has been defined but not used.

307Macro ‘name’: parameter count mismatch

The number of actual parameters in a macro call does not match the number of

 

parameters of the macro definition. This warning indicates that too many

7

 

parameters were used. Excess parameters are ignored.

317

Macro ‘name’: invalid redefinition

 

A predefined macro cannot be redefined or removed. Refer to “Predefined Macro

 

Constants” on page 138 for more information.

 

322Unknown identifier

The identifier in an #if directive line is undefined (evaluates to FALSE).

323Newline expected, extra characters found

A #directive line is correct but contains extra non commented characters. For example:

#include <stdio.h> foo

208

 

Chapter 7. Error Messages

 

 

 

 

 

 

 

 

 

Number

Warning Message and Description

 

 

 

 

 

324Preprocessor token expected

A preprocessor token was expected but a newline character was found in input. For example: #line where the arguments to the #line directive are missing.

7

Соседние файлы в папке HLP