swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] When did gcc get so lenient about the location of va


From: Paul Johnson
Subject: Re: [Swarm-Support] When did gcc get so lenient about the location of variable declarations?
Date: Mon, 14 Mar 2005 11:13:11 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041127)

IN FC3, they give us 3.4.2.

I'm working on some patches for Swarm that make the annoying compiler warnings disappear. It is mainly a problem of making method definitions exactly the same. If in one place we have

- activateIn: athing;

and another we have

- (id <Activity>)activateIn: athing;

then the compiler warning comes up every time a program is compiled that has activateIn. SO I'm getting rid of that. If you want to test those patches, I can give them to you.

I need help with one piece of syntax. Recall you can tell the compiler that a class exists, although it has not been presented yet, with the directive

@class TheClassName

IF you do that, then you can use (TheClassName *) as a return type and the compiler does not bother you.

What is the equivalent declaration for a protocol?

Why I need this. In swarm, the Activity protocol is big. THere are things that adopt it, such as ScheduleActivity.

There is one place in the Activity protocol where a return type needs to be

(id <ScheduleActivity>)

but the compiler can't allow that because ScheduleActivity does not exist at that time (it is defined below in the activity.y file). I have found one work around is to just make the declaration more general, as the following patch (which does silence the warning, at the price of some specificity in the declaration of getScheduleActivity:



diff -rc swarm-2.2-orig/src/activity/activity.h swarm-2.2/src/activity/activity.h *** swarm-2.2-orig/src/activity/activity.h 2005-03-13 10:38:15.830355928 -0600
--- swarm-2.2/src/activity/activity.h   2005-03-13 10:49:08.123481473 -0600
***************
*** 205,211 ****
  - getSwarmActivity;

  //M: Return most immediately containing Schedule activity.
! - getScheduleActivity;

  //M: Set serial execution mode.
  - setSerialMode: (BOOL)serialMode;
--- 205,211 ----
  - getSwarmActivity;

  //M: Return most immediately containing Schedule activity.
! - (id <Activity>)getScheduleActivity;

  //M: Set serial execution mode.
  - setSerialMode: (BOOL)serialMode;
diff -rc swarm-2.2-orig/src/activity/XActivity.h swarm-2.2/src/activity/XActivity.h *** swarm-2.2-orig/src/activity/XActivity.h 2005-03-13 10:38:15.839354633 -0600
--- swarm-2.2/src/activity/XActivity.h  2005-03-13 10:49:34.511684340 -0600
***************
*** 64,70 ****
  - (id <Activity>)getControllingActivity;
  - (id <Activity>)getTopLevelActivity;
  - (id <SwarmActivity>)getSwarmActivity;
! - (id <ScheduleActivity>)getScheduleActivity;
  - getSubactivities;
  - (void)setSerialMode: (BOOL)serialMode;
  - (BOOL)getSerialMode;
--- 64,70 ----
  - (id <Activity>)getControllingActivity;
  - (id <Activity>)getTopLevelActivity;
  - (id <SwarmActivity>)getSwarmActivity;
! - (id <Activity>)getScheduleActivity;
  - getSubactivities;
  - (void)setSerialMode: (BOOL)serialMode;
  - (BOOL)getSerialMode;
diff -rc swarm-2.2-orig/src/activity/XActivity.m swarm-2.2/src/activity/XActivity.m *** swarm-2.2-orig/src/activity/XActivity.m 2005-03-13 10:38:15.840354489 -0600
--- swarm-2.2/src/activity/XActivity.m  2005-03-13 10:49:52.756059086 -0600
***************
*** 587,593 ****
  //
// getScheduleActivity -- return most immediately containing Schedule activity
  //
! - (id <ScheduleActivity>)getScheduleActivity
  {
    Activity_c  *activity;

--- 587,593 ----
  //
// getScheduleActivity -- return most immediately containing Schedule activity
  //
! - (id <Activity>)getScheduleActivity
  {
    Activity_c  *activity;



In gcc 4, the warnings are orders of magnitude worse, so I removed that and now concentrate on 3.4.2.



Alex Lancaster wrote:
"PJ" == Paul Johnson  writes:


PJ> Recently I mistakenly inserted a for loop between some variable
PJ> declarations, but the program still compiled and ran.  In the old
PJ> days, I used to get a compiler warning/error saying I had used
PJ> unrecognized keywords for the variables that came after the for
PJ> loop.

What version of gcc are you using?



--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700


reply via email to

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