On Jan-12, Nicholas Clark wrote: > IIRC Leo added an option to Configure.pl to turn on optimising. > > Prior to this, on IRC Dan said to me that we need to avoid the hack that perl5 > found itself in, when it had to retro-fit the ability to change the compiler > flags per file. > > Currently I don't think we have this ability. I was wondering if we could do > it by specifying the optimiser flags in the form of > > /.../=xxx > !...!=xxx > > yyy > > where the first two give a regular expression for the object file(s) we wish > flags xxx to apply to. The alternative of !! for m!! should be allowed so > that paths can be specified in the object files as needed, without shell > escaping. All paths should be in Unix forward slash format, to reduce > potential confusion. If there are no flags, then yyy applies to all other > files.
Would it be better to do it the other way around? We could put a marker at the end of each source file (mixed in with the emacs/vi flag section?) that specifies a set of compiler flags (or nothing at all if the default is ok.) If so, then I'd probably also use named sets ("big-jumptable-flags") or maybe even named modifiers ("default but violates-aliasing and trips-gcc2.95-O3-bug"). This would allow better descriptions of why the flags were being modified, and allow each compiler to deal with the situation differently (for "violates-aliasing", gcc would add -fno-strict-aliasing, lcc wouldn't do anything.) I'm assuming the Configure system extracts the information from the source files and generates a makefile entry per source file with the appropriate compiler flags.