Optimizer warning and error messages – Zilog Z8F0130 User Manual

Page 297

Advertising
background image

UM013037-1212

Optimizer Warning and Error Messages

Zilog Developer Studio II – Z8 Encore!

User Manual

273

There are multiple string placement directives in a string constant that attempt to
direct the placement of the string in different address spaces.

Optimizer Warning and Error Messages

250 Missing format parameter to (s)printf

This message is generated when a call to printf or sprintf is missing the format param-
eter and the inline generation of printf calls is requested.

For example, a call of the form:

printf();

251 Can't preprocess format to (s)printf

This message is generated when the format parameter to printf or sprintf is not a string
literal and the inline generation of printf calls is requested.

For example, the following code causes this warning:

static char msg1 = "x = %4d";

char buff[sizeof(msg1)+4];

sprintf(buff,msg1,x); // WARNING HERE

This warning is generated because the line of code is processed by the real printf or
sprintf function, so that the primary goal of the inline processing, reducing the code
size by removing these functions, is not met.

When this message is displayed, you have three options:

Deselect the

Generate Printfs Inline

checkbox (see the

C: Advanced Page

sec-

tion on page 82) so that all calls to

printf

and

sprintf

are handled by the real

printf

or

sprintf

functions.

Recode to pass a string literal.

For example, the code in the example can be revised as:

define MSG1 "x = %4d"

char buff[sizeof(MSG1)+4];

sprintf(buff,MSG1,x); // OK

Keep the

Generate Printfs Inline

checkbox selected and ignore the warning. This

loses the primary goal of the option but results in the faster execution of the calls
to printf or sprintf that can be processed at compile time, a secondary goal of the
option.

252 Bad format string passed to (s)printf

This warning occurs when the compiler is unable to parse the string literal format and
the inline generation of

printf

calls is requested. A normal call to

printf

or

sprintf

is generated (which might also be unable to parse the format).

253 Too few parameters for (s)printf format

Advertising