Le 7 juin 09 à 20:27, Truls Becken a écrit : > On Sun, Jun 7, 2009 at 19:27, Quentin Mathé wrote: > >> Le 6 juin 09 à 20:09, Quentin Mathé a écrit : >> >>> Le 3 juin 09 à 22:38, Truls Becken a écrit : >>> >>>> There is also one I did not include in the diff; ETUUID uses an >>>> uninitialized variable on purpose to generate a random seed (as a >>>> fallback in case /dev/random does not work). GCC 4.4 does not like >>>> that. >> >> There is no __attribute___((uninitialized)), so may be you can try to >> see whether a diagnostic pragma works. I mean something like: >> #else >> #pragma GCC diagnostic ignored "-Wuninitialized" >> static void ETSRandomDev() >> { >> However I'm not sure this warning support to be tweaked with a >> pragma. >> If it isn't the case, we'll have to turn it off globally in Source/ >> GNUmakefile at least for platforms other than BSDs and Linux. > > The diagnostic pragma worked, but it affects the whole file, doesn't > it?
Right. The GCC documentation says these pragmas can only be safely set when they are located before the functions/datas in the file. > Declaring the variable as volatile also satisfied GCC. This has the > advantage of being fine grained, but it also unnecessarily turns off > all optimizations involving that variable, not that I think this > matters. > > Which approach is better? My personal preference goes to the pragma which describes precisely what is being worked around. 'volatile' suggests the variable is modified externally, so we would have to add a comment to describe why we use it here. Cheers, Quentin. _______________________________________________ Etoile-dev mailing list Etoile-dev@gna.org https://mail.gna.org/listinfo/etoile-dev