[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference lassie::ucx

Title:DEC TCP/IP Services for OpenVMS
Notice:Note 2-SSB Kits, 3-FT Kits, 4-Patch Info, 7-QAR System
Moderator:ucxaxp.ucx.lkg.dec.com::TIBBERT
Created:Thu Nov 17 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:5568
Total number of notes:21492

5297.0. "RPCGEN doesn't like #pragma" by CSC32::J_HENSON (Don't get even, get ahead!) Tue Mar 04 1997 15:40

ucx v4.1 eco4, openvms v6.2, dec c v5.5-002, alpha

RPCGEN is producing errors when attempting to process a file which
contains a #pragma directive.  The example listed below uses the
nomember_alignment directive, but using other pragmas will produce
similar results.

cc/proprocess_only msg.x 

compiles cleanly.

Is this a bug?  Per page 2-32 of the Digital TCP/IP Services for
OpenVMS   ONC RPC Programming (aa-q06vd-te), 

"RPCGEN runs the C preprocessor, CC/DECC/PREPROCESSOR,  all input
files before actually interpreted (sic) the files.  Therefore, all the
preprocessor directives are legal within an RPCGEN input file."

Thanks,

Jerry

==========================================================================

   Welcome to OpenVMS Alpha Operating System, Version V6.2 on node XWINGS
    Last interactive login on Tuesday,  4-MAR-1997 14:09:37.11
    Last non-interactive login on Friday,  7-FEB-1997 19:00:31.17
$ set def [.rpc]
$ 
$ 
$ ucx show version


  Digital TCP/IP Services for OpenVMS Alpha 
  Version V4.1 - ECO Level 4
  on a AlphaServer 1000 4/200 running OpenVMS V6.2    



$ 
$ 
$ type msg.x
/*
** msg.x: Remote message printing protocol
*/
#pragma nomember_alignment
program MESSAGEPROG {
    version MESSAGEVERS {
        int PRINTMESSAGE(string) = 1;
        } = 1;
    } = 0x20000099;
$ 
$ 
$ rpcgen msg.x
#pragma nomember_alignment
^


%RPCGEN-E-PREPROCESS, preprocessor error; can't understand result
-RPCGEN-I-ATLINE, at line 4 in file XWINGS$DKA100:[J_HENSON.RPC]MSG.X;4

T.RTitleUserPersonal
Name
DateLines
5297.1sprCSC32::J_HENSONDon't get even, get ahead!Fri Mar 07 1997 10:559
>>       <<< Note 5297.0 by CSC32::J_HENSON "Don't get even, get ahead!" >>>
>>                        -< RPCGEN doesn't like #pragma >-

>>Is this a bug?  Per page 2-32 of the Digital TCP/IP Services for
>>OpenVMS   ONC RPC Programming (aa-q06vd-te), 

I'm going to assume this is a bug, and spr this as a severity 2 issue.

Jerry
5297.2Here is the solution: the documentation is the bug not the RPCGEN codeUCXAXP::GEMIGNANIFri Mar 07 1997 18:0945
    
The customer reports that the #pragma preprocessor directive is not supported
within the body of the RPCGEN source (.x) file.  This has been investigated and,
RPCGEN does indeed reject the #pragma directive.

The problem itself is not the #pragma directive as processed by the DECC
compiler.  Rather, the problem is that RPCGEN does not understand this
`directive', as the DECC compiler does not remove it from the data stream as
it does with other preprocessor statements.  As a result, RPCGEN encounters
the `#pragma nonmember_alignment', and doesn't understand it, as it is not
part of the portable C language.

In order to properly handle this situation, RPCGEN allows lines which begin
with `%' to be passed through RPCGEN.  This must be used here because the
source is not portable.

The following examples would both provide control over alignment AND make
your code portable.  Note that since #pragma is a characteristic of the
compiler itself, you might prefer to use example 1.

Example 1: Support of #pragma for all DECC compilers:

	#ifdef __DECC
	%#pragma nonmember_alignment
	#endif
	
	program MESSAGEPROG {
	    version MESSAGEVERS {
	        int PRINTMESSAGE(string) = 1;
	        } = 1;
	    } = 0x20000099;

Example 2: Support of #pragma on all VMS systems:

	#ifdef __VMS
	%#pragma nonmember_alignment
	#endif
	
	program MESSAGEPROG {
	    version MESSAGEVERS {
	        int PRINTMESSAGE(string) = 1;
	        } = 1;
	    } = 0x20000099;