From owner-freebsd-hackers Sun Nov 5 04:47:56 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id EAA01514 for hackers-outgoing; Sun, 5 Nov 1995 04:47:56 -0800 Received: from cls.net (freeside.cls.de [192.129.50.1]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id EAA01509 for ; Sun, 5 Nov 1995 04:47:53 -0800 Received: by mail.cls.net (Smail3.1.28.1) from allegro.lemis.de (192.109.197.134) with smtp id ; Sun, 5 Nov 95 12:48 GMT From: grog@lemis.de (Greg Lehey) Organisation: LEMIS, Schellnhausen 2, 36325 Feldatal, Germany Phone: +49-6637-919123 Fax: +49-6637-919122 Reply-To: grog@lemis.de (Greg Lehey) Received: (grog@localhost) by allegro.lemis.de (8.6.9/8.6.9) id NAA12443; Sun, 5 Nov 1995 13:33:20 +0100 Message-Id: <199511051233.NAA12443@allegro.lemis.de> Subject: Re: RPC oddities To: joerg_wunsch@uriah.heep.sax.de Date: Sun, 5 Nov 1995 13:33:19 +0100 (MET) Cc: hackers@freebsd.org (FreeBSD Hackers) In-Reply-To: <199511041821.TAA02527@uriah.heep.sax.de> from "J Wunsch" at Nov 4, 95 07:21:06 pm X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 2114 Sender: owner-hackers@freebsd.org Precedence: bulk J Wunsch writes: > > includes definitions for several constants that are inside > enum's. To the contrary, #define's just the very same > constants. The result is that the compiler sees something like: > > enum auth_stat { > AUTH_OK=0, > > > 1 =1, > AUTH_REJECTEDCRED=2, > 3 =3, > AUTH_REJECTEDVERF=4, > 5 =5, > > > AUTH_INVALIDRESP=6, > AUTH_FAILED=7 > }; > > or even worse: > > enum clnt_stat { > RPC_SUCCESS=0, > > > RPC_CANTENCODEARGS=1, > RPC_CANTDECODERES=2, > RPC_CANTSEND=3, > RPC_CANTRECV=4, > RPC_TIMEDOUT=5, > > > RPC_VERSMISMATCH=6, > RPC_AUTHERROR=7, > 1 =8, > RPC_PROGVERSMISMATCH=9, > 3 =10, > ... > }; > > > What would be the correct way to resolve the conflicts? How about a series of: /* Authentication failures */ #undef AUTH_BADCRED 1 #undef AUTH_REJECTCRED 2 #undef AUTH_BADVERF 3 #undef AUTH_REJECTVERF 4 #undef AUTH_TOOWEAK 5 /* Give em wheaties */ If you're really paranoid, you could change that to #ifdef AUTH_BADCRED # if AUTH_BADCRED != 1 # error incorrect redefinition of AUTH_BADCRED #endif #undef AUTH_BADCRED #endif #ifdef AUTH_REJECTCRED # if AUTH_REJECTCRED != 2 # error incorrect redefinition of AUTH_REJECTCRED #endif #undef AUTH_REJECTCRED #endif #ifdef AUTH_BADVERF # if AUTH_BADVERF != 3 # error incorrect redefinition of AUTH_BADVERF #endif #undef AUTH_BADVERF #endif #ifdef AUTH_REJECTVERF # if AUTH_REJECTVERF != 4 # error incorrect redefinition of AUTH_REJECTVERF #endif #undef AUTH_REJECTVERF #endif #ifdef AUTH_TOOWEAK # if AUTH_TOOWEAK != 5 # error incorrect redefinition of AUTH_TOOWEAK #endif #undef AUTH_TOOWEAK #endif /* Give em wheaties */