Borland BCC32 compiler version 5.6.4 produces the
following errors and warnings when compiling log.c from
the CVS.
! Error E2140 ..\..\..\..\libmss\log.c 120: Declaration
is not allowed here in function mss_get_ptr_distance_info
! Warning W8071 ..\..\..\..\libmss\log.c 480:
Conversion may lose significant digits in function
mss_log_disable
! Warning W8071 ..\..\..\..\libmss\log.c 498:
Conversion may lose significant digits in function
mss_log_enable
! Warning W8065 ..\..\..\..\libmss\log.c 612: Call to
function 'mss_log_list_blocks_internal' with no
prototype in function mss_log_list_blocks
! Error E2140 ..\..\..\..\libmss\log.c 632: Declaration
is not allowed here in function mss_log_check_node_warnings
! Error E2140 ..\..\..\..\libmss\log.c 647: Declaration
is not allowed here in function mss_log_check_node_warnings
! Error E2140 ..\..\..\..\libmss\log.c 662: Declaration
is not allowed here in function mss_log_check_node_warnings
Here are the explanations from the Borland Help file:
E2140 Declaration is not allowed here
Declarations can't be used as the control statement for
while, for, do, if, or switch statements.
W8071 Conversion may lose significant digits
For an assignment operator or some other circumstance,
your source file requires a conversion from a larger
integral data type to a smaller integral data type
where the conversion exists.
Because the integral data type variables don't have the
same size, this kind of conversion might alter the
behavior of a program.
W8065 Call to function 'function' with no prototype
This message is given if the "Prototypes required"
warning is enabled and you call function 'function'
without first giving a prototype for that function.
Logged In: YES
user_id=250965
For the first Error E2140, I added
int msg_len = MSG_LEN + 1;
at log.c, line 116. Then I changed line 123 to
msg_len = snprintf(dist_str, MSG_LEN, " (distance = %lu)",
(unsigned long)ptr_distance);
Now the function structure is similar to the
mss_get_block_info function above.
Warning W8071 ..\..\..\..\libmss\log.c 492: Conversion may
lose significant digits in function mss_log_disable
mss_options = mss_options & (~MSS_SHOW_LOGS);
and
Warning W8071 ..\..\..\..\libmss\log.c 512: Conversion may
lose significant digits in function mss_log_enable
mss_options = mss_options | MSS_SHOW_LOGS;
mss_options is an unsigned char. (unsigned char mss_options
= 0; init.c, line 55.) MSS_SHOW_LOGS is probably an int.
(#define MSS_SHOW_LOGS 2, internal.h, line 136.) If the
type of mss_options matched MSS_SHOW_LOGS, the Borland
compiler would not complain but I don't know what that
change would break.
Warning W8065 ..\..\..\..\libmss\log.c 633: Call to function
'mss_log_list_blocks_internal' with no prototype in function
The declaration
void mss_log_list_blocks_internal();
is in mss.h at line 177 and the definition is in log.c at
line 593.
I removed the warning by changing the declaration of the
function at line 177 in my copy of mss.h to:
void mss_log_list_blocks_internal(void);
For the last three errors:
Error E2140 ..\..\..\..\libmss\log.c 654: Declaration is not
allowed here in function mss_log_check_node_warnings
Error E2140 ..\..\..\..\libmss\log.c 669: Declaration is not
allowed here in function mss_log_check_node_warnings
Error E2140 ..\..\..\..\libmss\log.c 684: Declaration is not
allowed here in function mss_log_check_node_warnings
I copied
char msg[MSG_LEN];
to line 648 and commented out the three other instances of
that line elsewhere in the function.
Index: log.c
RCS file: /cvsroot/libmss/libmss/log.c,v
retrieving revision 1.21
diff -r1.21 log.c
116c116
<
---
> int msg_len = MSG_LEN + 1;
123c123
< int msg_len = snprintf(dist_str, MSG_LEN, " (distance
= %lu)",
---
> msg_len = snprintf(dist_str, MSG_LEN, " (distance = %lu)",
646a647
> char msg[MSG_LEN];
653d653
< char msg[MSG_LEN];
668d667
< char msg[MSG_LEN];
683d681
< char msg[MSG_LEN];