This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Ada] bacth of minor warning and style fixes
- From: <guerby at acm dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 Nov 2001 22:16:37 +0100
- Subject: [Ada] bacth of minor warning and style fixes
- Reply-to: guerby at acm dot org
I'm testing this and will commit tomorrow unless someone complains
(I'm no C-style expert and making change to platform conditional code
I can't test). Some bits have been approved privately by Richard
Kenner, some others are preapproved in principle.
- The Make-lang.in change triggers some new back-end warnings
in Ada RTS code.
- io-aux.c now includes conditionally on IN_RTS either "config.h" or
"tconfig.h" to get access to PARAMS, io-aux.c is not used without
IN_RTS in the build process but I felt it was safer this way in case
of future uses (and it matches what sysdep.c does).
- I noticed sysdep.c has no header file dependency in ada/Makefile.in
so I didn't add those to io-aux.c in this patch. I think both need to
depend on $(CONFIG_H) and $(TCONFIG_H) (plus may be others for
sysdep.c), if someone with more expertise in the area could check
those, that would be great.
- May be it's even better to use "hconfig.h" and $(HCONFIG_H) but I
couldn't find doc in gcc/Makefile.in about what should be used so I
did mimic what other Ada file do, and they dont use hconfig at all.
--
Laurent Guerby <guerby@acm.org>
2001-11-16 Laurent Guerby <guerby@acm.org>
* Make-lang.in (GNATLIBFLAGS): Add -W -Wall.
* gigi.h (init_decl_processing): Rename to gnat_init_decl_processing.
* io-aux.c: Provide K&R prototypes to all functions, reformat code.
* lang-spec.h: Add missing struct field to silence warnings.
* sysdep.c (rts_get_*): Provide K&R prototype.
* sysdep.c (Unlock_Task, Lock_Task): Move to K&R prototype.
* traceback.c (Unlock_Task, Lock_Task): Likewise.
* tracebak.c (__gnat_backtrace): Remove unused variable.
* utils.c (end_subprog_body): Move to K&R style.
Index: Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/Make-lang.in,v
retrieving revision 1.4
diff -c -3 -p -r1.4 Make-lang.in
*** Make-lang.in 2001/10/22 20:39:56 1.4
--- Make-lang.in 2001/11/16 21:01:25
*************** shext =
*** 48,54 ****
# Extra flags to pass to recursive makes.
BOOT_ADAFLAGS= $(ADAFLAGS)
ADAFLAGS= -W -Wall -gnatpg -gnata
! GNATLIBFLAGS= -gnatpg
GNATLIBCFLAGS= -g -O2
ADA_INCLUDE_DIR = $(libsubdir)/adainclude
ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
--- 48,54 ----
# Extra flags to pass to recursive makes.
BOOT_ADAFLAGS= $(ADAFLAGS)
ADAFLAGS= -W -Wall -gnatpg -gnata
! GNATLIBFLAGS= -W -Wall -gnatpg
GNATLIBCFLAGS= -g -O2
ADA_INCLUDE_DIR = $(libsubdir)/adainclude
ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
Index: gigi.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/gigi.h,v
retrieving revision 1.2
diff -c -3 -p -r1.2 gigi.h
*** gigi.h 2001/10/23 22:59:52 1.2
--- gigi.h 2001/11/16 21:01:28
*************** extern tree pushdecl PARAMS ((tree));
*** 433,439 ****
/* Create the predefined scalar types such as `integer_type_node' needed
in the gcc back-end and initialize the global binding level. */
! extern void init_decl_processing PARAMS ((void));
extern void init_gigi_decls PARAMS ((tree, tree));
/* Return an integer type with the number of bits of precision given by
--- 433,439 ----
/* Create the predefined scalar types such as `integer_type_node' needed
in the gcc back-end and initialize the global binding level. */
! extern void gnat_init_decl_processing PARAMS ((void));
extern void init_gigi_decls PARAMS ((tree, tree));
/* Return an integer type with the number of bits of precision given by
Index: io-aux.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/io-aux.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 io-aux.c
*** io-aux.c 2001/10/02 14:15:38 1.1
--- io-aux.c 2001/11/16 21:01:28
***************
*** 34,54 ****
#include <stdio.h>
/* Function wrappers are needed to access the values from Ada which are */
/* defined as C macros. */
! FILE *c_stdin (void) { return stdin; }
! FILE *c_stdout (void) { return stdout;}
! FILE *c_stderr (void) { return stderr;}
#ifndef SEEK_SET /* Symbolic constants for the "fseek" function: */
#define SEEK_SET 0 /* Set file pointer to offset */
#define SEEK_CUR 1 /* Set file pointer to its current value plus offset */
#define SEEK_END 2 /* Set file pointer to the size of the file plus offset */
#endif
! int seek_set_function (void) { return SEEK_SET; }
! int seek_end_function (void) { return SEEK_END; }
! void *null_function (void) { return NULL; }
! int c_fileno (FILE *s) { return fileno (s); }
--- 34,100 ----
#include <stdio.h>
+ #ifdef IN_RTS
+ #include "tconfig.h"
+ #else
+ #include "config.h"
+ #endif
+
/* Function wrappers are needed to access the values from Ada which are */
/* defined as C macros. */
+
+ FILE *c_stdin PARAMS ((void));
+ FILE *c_stdout PARAMS ((void));
+ FILE *c_stderr PARAMS ((void));
+ int seek_set_function PARAMS ((void));
+ int seek_end_function PARAMS ((void));
+ void *null_function PARAMS ((void));
+ int c_fileno PARAMS ((FILE *));
+
+ FILE *
+ c_stdin ()
+ {
+ return stdin;
+ }
! FILE *
! c_stdout ()
! {
! return stdout;
! }
+ FILE *
+ c_stderr ()
+ {
+ return stderr;
+ }
+
#ifndef SEEK_SET /* Symbolic constants for the "fseek" function: */
#define SEEK_SET 0 /* Set file pointer to offset */
#define SEEK_CUR 1 /* Set file pointer to its current value plus offset */
#define SEEK_END 2 /* Set file pointer to the size of the file plus offset */
#endif
+
+ int
+ seek_set_function ()
+ {
+ return SEEK_SET;
+ }
+
+ int
+ seek_end_function ()
+ {
+ return SEEK_END;
+ }
! void *null_function ()
! {
! return NULL;
! }
! int
! c_fileno (s)
! FILE *s;
! {
! return fileno (s);
! }
Index: lang-specs.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/lang-specs.h,v
retrieving revision 1.1
diff -c -3 -p -r1.1 lang-specs.h
*** lang-specs.h 2001/10/02 14:18:39 1.1
--- lang-specs.h 2001/11/16 21:01:29
***************
*** 29,36 ****
/* This is the contribution to the `default_compilers' array in gcc.c for
GNAT. */
! {".ads", "@ada"},
! {".adb", "@ada"},
{"@ada",
"gnat1 %{^I*} %{k8:-gnatk8} %{w:-gnatws} %1 %{!Q:-quiet} %{nostdinc*}\
-dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\
--- 29,36 ----
/* This is the contribution to the `default_compilers' array in gcc.c for
GNAT. */
! {".ads", "@ada", 0},
! {".adb", "@ada", 0},
{"@ada",
"gnat1 %{^I*} %{k8:-gnatk8} %{w:-gnatws} %1 %{!Q:-quiet} %{nostdinc*}\
-dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\
***************
*** 40,43 ****
%i %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
%{!S:%{!gnatc:%{!gnatz:%{!gnats:as %a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}\
%{!c:%e-c or -S required for Ada}\
! %{!pipe:%g.s} %A\n}}}} "},
--- 40,43 ----
%i %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
%{!S:%{!gnatc:%{!gnatz:%{!gnats:as %a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}\
%{!c:%e-c or -S required for Ada}\
! %{!pipe:%g.s} %A\n}}}} ", 0},
Index: sysdep.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/sysdep.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 sysdep.c
*** sysdep.c 2001/10/29 17:45:03 1.3
--- sysdep.c 2001/11/16 21:01:31
*************** getc_immediate_common (stream, ch, end_o
*** 521,530 ****
will want to import these). We use the same names as the routines used
by AdaMagic for compatibility. */
! char *rts_get_hInstance (void) { return (GetModuleHandleA (0)); }
! char *rts_get_hPrevInstance (void) { return (0); }
! char *rts_get_lpCommandLine (void) { return (GetCommandLineA ()); }
! int rts_get_nShowCmd (void) { return (1); }
#endif /* WINNT */
#ifdef VMS
--- 521,535 ----
will want to import these). We use the same names as the routines used
by AdaMagic for compatibility. */
! char *rts_get_hInstance PARAMS ((void));
! char *rts_get_hPrevInstance PARAMS ((void));
! char *rts_get_lpCommandLine PARAMS ((void));
! int rts_get_nShowCmd PARAMS ((void));
!
! char *rts_get_hInstance () { return (GetModuleHandleA (0)); }
! char *rts_get_hPrevInstance () { return (0); }
! char *rts_get_lpCommandLine () { return (GetCommandLineA ()); }
! int rts_get_nShowCmd () { return (1); }
#endif /* WINNT */
#ifdef VMS
*************** get_gmtoff ()
*** 551,560 ****
#if defined (_AIX) || defined (__EMX__)
#define Lock_Task system__soft_links__lock_task
! extern void (*Lock_Task) (void);
#define Unlock_Task system__soft_links__unlock_task
! extern void (*Unlock_Task) (void);
/* Provide reentrant version of localtime on Aix and OS/2. Note that AiX does
provide localtime_r, but in the library libc_r which doesn't get included
--- 556,565 ----
#if defined (_AIX) || defined (__EMX__)
#define Lock_Task system__soft_links__lock_task
! extern void (*Lock_Task) PARAMS ((void));
#define Unlock_Task system__soft_links__unlock_task
! extern void (*Unlock_Task) PARAMS ((void));
/* Provide reentrant version of localtime on Aix and OS/2. Note that AiX does
provide localtime_r, but in the library libc_r which doesn't get included
Index: tracebak.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/tracebak.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 tracebak.c
*** tracebak.c 2001/10/04 17:50:42 1.2
--- tracebak.c 2001/11/16 21:01:34
***************
*** 61,70 ****
#endif
#define Lock_Task system__soft_links__lock_task
! extern void (*Lock_Task) (void);
#define Unlock_Task system__soft_links__unlock_task
! extern void (*Unlock_Task) (void);
#ifndef CURRENT_STACK_FRAME
# define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
--- 61,70 ----
#endif
#define Lock_Task system__soft_links__lock_task
! extern void (*Lock_Task) PARAMS ((void));
#define Unlock_Task system__soft_links__unlock_task
! extern void (*Unlock_Task) PARAMS ((void));
#ifndef CURRENT_STACK_FRAME
# define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
*************** __gnat_backtrace (array, size, exclude_m
*** 202,208 ****
struct layout *current;
void *top_frame;
void *top_stack;
- void *ret;
int cnt = 0;
#ifdef PROTECT_SEGV
--- 202,207 ----
Index: utils.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/utils.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 utils.c
*** utils.c 2001/11/15 10:00:54 1.4
--- utils.c 2001/11/16 21:01:40
*************** begin_subprog_body (subprog_decl)
*** 1829,1835 ****
to assembler language output. */
void
! end_subprog_body (void)
{
tree decl;
tree cico_list;
--- 1829,1835 ----
to assembler language output. */
void
! end_subprog_body ()
{
tree decl;
tree cico_list;