liberty-eiffel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Liberty-eiffel] Question: many warning messages when compiling the


From: Raphael Mack
Subject: Re: [Liberty-eiffel] Question: many warning messages when compiling the germ with Pelles-C
Date: Wed, 13 Aug 2014 20:13:30 +0000
User-agent: Internet Messaging Program (IMP) H5 (6.2.1)

Hi,

this should be still true for LibertyEiffel, but it's only possible to remove the variables for code generated from Eiffel and there are some parts which are natively written in C. What are the concrete warnings? Maybe they come from some "#ifdef WIN32"-only code?

On the other side are there many more such kind of C compiler (or Lint) warnings which could/should be fixed in the C code generation. Wasn't there someone (maybe even you Hans) who wanted to apply Lint on the generated code? - I am still convinced, that it would be good to generated lint-free C, but yes, compiler-warning free is the first step into this direction.

One example I know of is there quite often in the generated C code:

switch(id){
case 7:
tmp0 = a;
break;
case 309:
tmp0 = b;
break;
case 318:
tmp0 = c;
break;
default:;
error1("Invalid type for the target of this function call.",0x09003830/*l56c24/output_stream_tools.e*/);
}

_count=tmp0;

warning: ‘tmp0’ may be used uninitialized in this function [GCC -Wmaybe-uninitialized]

we can fix this by replacing

void error1(char*m,se_position position);
by
void error1(char*m,se_position position) __attribute__ ((noreturn));

as error1 calls exit() (or sedb_break) anyhow.

But as this is a fix specific for GCC it is questionable whether it is worth to make the code more complicated... - I'd vote for the change, anyhow.

Cheers,
Rapha



Zitat von Hans Zwakenberg  |  Ocean Consulting GmbH <address@hidden>:

Hi,

when compiling the germ's 130+ files on Windows (using Pelles-C) I noticed that the compiler produces a lot of warnings about variables or structures that are
never used by the application, especially so if you suppress none of the
warnings the compiler is able to generate.

This baffled me, as I still remember one of the academic papers (I think it was written by Dominique at the time) that explained how SmartEiffel is doing global
optimisation by building a tree of all life objects and methods.  I seem to
recollect that the paper went as far as to claim that unused single variables in
structs are optimised out as well.

Is any of this still on board with Liberty Eiffel?  If so, would generating a
single C file instead of the 130+ reduce the number of such warning messages
(and allow the C compiler to do better optimisations) ?

Just trying to get back into the game and trying to learn the differences
between SmartEiffel and Liberty here...

cheers
Hans






reply via email to

[Prev in Thread] Current Thread [Next in Thread]