Path: utzoo!utgpu!watmath!att!dptg!rutgers!apple!usc!cs.utexas.edu!csd4.csd.uwm.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: anders@verity.com (Anders Wallgren) Newsgroups: comp.sys.sun Subject: #pragma with SunOS 3 cpp? Keywords: SunOS Message-ID: <991@brazos.Rice.edu> Date: 16 Aug 89 23:29:52 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 37 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 100, message 9 of 14 We are having a problem with the C preprocessor on a Sun 3 running SunOS 3, relating to how it deals with #pragma's. Since cpp doesn't know about #pragma's, but the other compilers that are run over the source code do, we tried something along the following line, the idea being that we define NOT_SUN33 when compiling on other platforms: int foo(a, b) int a,b; { #ifdef NOT_SUN33 #pragma unused(b) #endif return(a) } But this confuses cpp: with NOT_SUN33 _undefined_ it complains Undefined Control in (whatever line contains the #pragma) Apparently, the #pragma confuses the preprocessor to the point that even though NOT_SUN33 is undefined, it tries to interpret it while looking for the #endif. Our first inclination was to do some kind of macro around it, but you can't macro around a pre-processor directive, since it doesn't quite follow up on the recursive nature of that beast. So, the question is: Has anybody else run into this problem while getting code to compile under different platforms? Is there a way to fool the Sun 3 SunOS 3 cpp into ignoring the #pragma while trying to close out the #ifdef that sits around it? Anders Wallgren Software Engineer Verity, Inc.