From Zoltan.Toth@REDACTED Wed Sep 10 11:44:58 2003 From: Zoltan.Toth@REDACTED (Zoltan Peter Toth) Date: Wed, 10 Sep 2003 11:44:58 +0200 Subject: Hipe build problem in R9C-0 Message-ID: <3F5EF29A.7080209@eth.ericsson.se> Hi, When trying to build OTP R9C-0 on Linux, this happens: === Entering application hipe make[3]: Entering directory `/home/ethtzp/temp/otp_src_R9C-0/lib/hipe/rtl' erlc -W -bbeam +debug_info -o../ebin hipe_rtl.erl erlc -W -bbeam +debug_info -o../ebin hipe_rtl_cfg.erl erlc -W -bbeam +debug_info -o../ebin hipe_rtl_cse.erl erlc -W -bbeam +debug_info -o../ebin hipe_rtl_ebb.erl erlc -W -bbeam +debug_info -o../ebin hipe_rtl_liveness.erl erlc -W -bbeam +debug_info -o../ebin hipe_rtl_prop.erl erlc -W -bbeam +debug_info -o../ebin hipe_icode2rtl.erl erlc -W -bbeam +debug_info -o../ebin hipe_tagscheme.erl /home/ethtzp/temp/otp_src_R9C-0/lib/hipe/rtl/hipe_tagscheme.erl:695: undefined macro ''P_OFF_HEAP_OVERHEAD'' /home/ethtzp/temp/otp_src_R9C-0/lib/hipe/rtl/hipe_tagscheme.erl:37: function finalize_bin/4 undefined (The latter error is just a consequence of the first, as the undefined macro is found within the definition of finalize_bin/4). I attach the hipe_tagscheme.erl. What may be wrong ? Regards, Zoltan From cpressey@REDACTED Wed Sep 17 01:00:15 2003 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 16 Sep 2003 16:00:15 -0700 Subject: filelib:fold_files/5 Message-ID: <20030916160015.4c2d3614.cpressey@catseye.mine.nu> Hi, No offense to Mr. Gustavsson, but filelib:fold_files/5 looks like it was written while he was asleep :) Attached is a patch which makes it (at least) work. But I think it would be good to consider a change to its definition first. With the present behaviour, the callback never sees directory entries themselves. So, for example, empty directories are never detected. I think the behaviour would be more useful if it called the fun for both plain files and directories. The callback could also accept a flag, like fun(Filename, IsDir, Acc), so that it doesn't have to do the test itself (since fold_files/5 already does it anyway.) What do you think? Other than that one issue, I like the filelib module a lot! Keep up the good work. -Chris -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: filelib.erl.diff URL: From cpressey@REDACTED Wed Sep 17 18:27:59 2003 From: cpressey@REDACTED (Chris Pressey) Date: Wed, 17 Sep 2003 09:27:59 -0700 Subject: filelib:fold_files/5 In-Reply-To: <20030916160015.4c2d3614.cpressey@catseye.mine.nu> References: <20030916160015.4c2d3614.cpressey@catseye.mine.nu> Message-ID: <20030917092759.4d0863a7.cpressey@catseye.mine.nu> Sorry to reply to my own message, but I've given this some thought, and at this point I think it's more question than bug report so I'm forwarding it to erlang-questions. To recap, filelib:fold_files/5... - is a great idea - is documented - does not work at all :( - is written to only visit plain files, never directories - requires a global regexp - requires a global recursion flag I think the way to maximize the utility of this function is to... - make it visit both files and directories and pass an IsDir flag - make it not require a global regexp (make the fun check, itself) - let the fun return a local recursion flag (fine-grained recursion) This way, you can (say) use different regexps on plain files and directories, and you can skip entire subtrees that you do not want to scan. This is much more powerful. My proposal is a completely rewritten function, fold_files/3. fold_files/5 can easily be rewritten as a wrapper around fold_files/3. I've included them both below, for your perusal. %% @spec fold_files(dir(), fun(), term()) -> term() %% @doc Folds the function Fun(F, IsDir, Acc) -> {Recurse, Acc1} over %% all files F in Dir that match the regular expression RegExp. %% If Recurse is true all sub-directories of F are processed. %% (This function is a modified version of that from filelib.erl) fold_files(Dir, Fun, Acc) -> case file:list_dir(Dir) of {ok, Files} -> fold_files0(Files, Dir, Fun, Acc); {error, _} -> Acc end. fold_files0([File | Tail], Dir, Fun, Acc) -> FullName = filename:join([Dir, File]), IsDir = filelib:is_dir(FullName), {Recurse, NewAcc} = Fun(FullName, IsDir, Acc), fold_files0(FullName, Tail, Dir, Fun, IsDir, Recurse, NewAcc); fold_files0([], Dir, Fun, Acc) -> Acc. fold_files0(FullName, Tail, Dir, Fun, true, true, Acc) -> NewAcc = fold_files(FullName, Fun, Acc), fold_files0(Tail, Dir, Fun, NewAcc); fold_files0(FullName, Tail, Dir, Fun, _, _, Acc) -> fold_files0(Tail, Dir, Fun, Acc). %% @spec fold_files(dir(), regexp(), bool(), fun(), term()) -> term() %% Wrapper for the original fold_files/5 behaviour. fold_files(Dir, RegExp, Recursive, Fun, InitialAcc) -> {ok, CompiledRegExp} = regexp:parse(RegExp), Wrapper = fun (FullName, false, Acc) -> NewAcc = case regexp:match(FullName, CompiledRegExp) of {match, _, _} -> Fun(FullName, Acc); _ -> Acc end, {Recursive, NewAcc}; (_, true, Acc) -> {Recursive, Acc} end, fold_files(Dir, Wrapper, InitialAcc). On Tue, 16 Sep 2003 16:00:15 -0700 Chris Pressey wrote: > Hi, > > No offense to Mr. Gustavsson, but filelib:fold_files/5 looks like it > was written while he was asleep :) > > Attached is a patch which makes it (at least) work. But I think it > would be good to consider a change to its definition first. > > With the present behaviour, the callback never sees directory entries > themselves. So, for example, empty directories are never detected. I > think the behaviour would be more useful if it called the fun for both > plain files and directories. The callback could also accept a flag, > like fun(Filename, IsDir, Acc), so that it doesn't have to do the test > itself (since fold_files/5 already does it anyway.) > > What do you think? > > Other than that one issue, I like the filelib module a lot! Keep up > the good work. > > -Chris > From cpressey@REDACTED Thu Sep 18 04:37:04 2003 From: cpressey@REDACTED (Chris Pressey) Date: Wed, 17 Sep 2003 19:37:04 -0700 Subject: erlc (R9C) hangs when last line is missing EOF Message-ID: <20030917193704.146f0c51.cpressey@catseye.mine.nu> Try this: -module(blah). %%% BEGIN blah %%% -export([foo/0]). foo() -> bar. %%% END of blah %%% ^ do not include an EOL here. # erlc foo.erl <> This happens for me both on FreeBSD-4.9 PRERELEASE and Windows 98. (Also, I can't seem to gracefully kill erlc on Windows 98 when this happens - Ctrl-C gives me the menu, but the 'a' option doesn't work.) This only seems to happen when the last line is a comment AND is missing an EOL. -Chris From erlang@REDACTED Thu Sep 18 07:46:59 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 18 Sep 2003 06:46:59 +0100 Subject: erlc (R9C) hangs when last line is missing EOF In-Reply-To: <20030917193704.146f0c51.cpressey@catseye.mine.nu> References: <20030917193704.146f0c51.cpressey@catseye.mine.nu> Message-ID: <3F6946D3.9060505@manderp.freeserve.co.uk> I've seen this on SuSE 8.2 linux too. There's an easy work-around (-: Pete. Chris Pressey wrote: > Try this: > > > -module(blah). > %%% BEGIN blah %%% > -export([foo/0]). > foo() -> bar. > %%% END of blah %%% > ^ do not include an EOL here. > > > # erlc foo.erl > <> > > This happens for me both on FreeBSD-4.9 PRERELEASE and Windows 98. > (Also, I can't seem to gracefully kill erlc on Windows 98 when this > happens - Ctrl-C gives me the menu, but the 'a' option doesn't work.) > > This only seems to happen when the last line is a comment AND is missing > an EOL. > > -Chris > >