[m-rev.] for review: filter gcc output

Julien Fischer juliensf at csse.unimelb.edu.au
Sat Jul 10 02:01:27 AEST 2010


On Fri, 9 Jul 2010, Peter Wang wrote:

>>> +int
>>> +main(void)
>>
>> s/void/int argc, char **argv/ since the former may be rejected by
>> particularly picky compilers (since it's not actually C).
>
> Broken, rather: http://c-faq.com/ansi/maindecl.html

Ignore me - I'm talking nonsense there.

> Committing with these changes.
>

...

I have committed the following change to this.

Julien.

------------------------

Branches: main, 10.04

Avoid portability problems in the mgnuc script.

scripts/mgnuc.in:
 	When filtering the output of gcc, ensure that fd 3 is actually
 	open.  (It appears to work as written with full bash, but shells
 	that are closer to just POSIX sh emit errors about bad file
 	descriptors.)

Index: mgnuc.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.130
diff -u -r1.130 mgnuc.in
--- mgnuc.in	9 Jul 2010 07:10:16 -0000	1.130
+++ mgnuc.in	9 Jul 2010 15:20:25 -0000
@@ -694,9 +694,11 @@
  # 3>&- closes fd 3 on both sides of the pipeline
  case $#,$FILTERCC in
      0,)  exec $CC $ALL_CC_OPTS $OVERRIDE_OPTS ;;
-    0,*) exec $CC $ALL_CC_OPTS $OVERRIDE_OPTS \
+    0,*) exec 3>&1
+         exec $CC $ALL_CC_OPTS $OVERRIDE_OPTS \
              2>&1 >&3 3>&- | $FILTERCC >&2 3>&- ;;
      *,)  exec $CC $ALL_CC_OPTS "$@" $OVERRIDE_OPTS $ALL_LOCAL_C_INCL_DIRS ;;
-    *,*) exec $CC $ALL_CC_OPTS "$@" $OVERRIDE_OPTS $ALL_LOCAL_C_INCL_DIRS \
+    *,*) exec 3>&1
+         exec $CC $ALL_CC_OPTS "$@" $OVERRIDE_OPTS $ALL_LOCAL_C_INCL_DIRS \
              2>&1 >&3 3>&- | $FILTERCC >&2 3>&- ;;
  esac
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list