BUGFIX: TORTURE.C - Fixes to allow builds with Compaq C

John E. Malmberg malmberg at Encompasserve.org
Tue Jul 10 13:52:40 GMT 2001


The following changes were needed to get SAMBA 2.2.x Jul 9th CVS snapshot
to compile on OpenVMS 7.2-1 Alpha using Compaq C Version 6.4-005.

Note that this is just for compiling.  I still have a bit of work to do to
get it to actually run.

Compaq C is common to Tru-64 Unix, Linux on Alpha, and OpenVMS.

-----------------
TORTURE.C

In this module, (char *) is being passed to a routine prototyped for
(unsigned char *).  On Compaq C, this requires a cast.

Also the compiler is detecting that several pointers are declared as
volatile.  This is incompatable with passing them to a routine that
does not expect the pointer to change out from under it.

It appears that what was really meant is to declare the data the pointer
is referencing as volatile, and that both fixes the compilation warnings
and removes the need for the casts.

Example:
    volatile BOOL * shared_correct;
   /* The pointer is volatile, it's value can be changed at any time */

    BOOL * volatile shared_correct;
   /* The data the pointer is referencing is volatile, the pointer itself
      will not change from an asynchronous routine */

(Not being a language lawyer, I could be wrong on this, but as far as I can
 tell from my references, it appears that these changes are needed.)


TORTURE_C.DIFF
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;1
  443   		generate_random_buffer(buf, buf_size, False);
  444
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;4
  443   		generate_random_buffer((unsigned char *)buf, buf_size, False);
  444
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;1
 2242   	volatile BOOL *shared_correct;
 2243
 2244   	shared_correct = (volatile BOOL *)shm_setup(sizeof(BOOL));
 2245   	*shared_correct = True;
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;4
 2242   	BOOL * volatile shared_correct;
 2243
 2244   	shared_correct = shm_setup(sizeof(BOOL));
 2245   	*shared_correct = True;
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;1
 2963   	volatile pid_t *child_status;
 2964   	volatile BOOL *child_status_out;
 2965   	int synccount;
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;4
 2963   	pid_t * volatile child_status;
 2964   	BOOL * volatile child_status_out;
 2965   	int synccount;
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;1
 2970   	child_status = (volatile pid_t *)shm_setup(sizeof(pid_t)*nprocs);
 2971   	if (!child_status) {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;4
 2970   	child_status = shm_setup(sizeof(pid_t)*nprocs);
 2971   	if (!child_status) {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;1
 2976   	child_status_out = (volatile BOOL *)shm_setup(sizeof(BOOL)*nprocs);
 2977   	if (!child_status_out) {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;4
 2976   	child_status_out = shm_setup(sizeof(BOOL)*nprocs);
 2977   	if (!child_status_out) {
************

Number of difference sections found: 5
Number of difference records found: 8

DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=PROJECT_ROOT:[SAMBA_VMS.SOURCE]TORTURE_C.DIFF;1-
    PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;1-
    PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]TORTURE.C;4


-John
wb8tyw at qsl.network
Personal Opinion Only





More information about the samba-technical mailing list