* lang-specs.h: Pass -gnatwa if -Wall is passed.
* misc.c (gnat_handle_option) <OPT_Wall>: Expand into -Wunused
and -Wuninitialized.
(gnat_post_options): Clear warn_unused_parameter.
From-SVN: r133030
+2008-03-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * lang-specs.h: Pass -gnatwa if -Wall is passed.
+ * misc.c (gnat_handle_option) <OPT_Wall>: Expand into -Wunused
+ and -Wuninitialized.
+ (gnat_post_options): Clear warn_unused_parameter.
+
2008-03-08 Eric Botcazou <ebotcazou@adacore.com>
* utils.c (finish_record_type): Clear DECL_BIT_FIELD on sufficiently
* *
* C Header File *
* *
- * Copyright (C) 1992-2007, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2008, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
"\
%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
%{!S:%{!c:%e-c or -S required for Ada}}\
- gnat1 %{I*} %{k8:-gnatk8} %{w:-gnatws} %{!Q:-quiet} %{nostdinc*}\
- %{nostdlib*}\
+ gnat1 %{I*} %{k8:-gnatk8} %{Wall:-gnatwa} %{w:-gnatws} %{!Q:-quiet}\
+ %{nostdinc*} %{nostdlib*}\
-dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\
%{O*} %{W*} %{w} %{p} %{pg:-p} %{a} %{f*} %{d*} %{g*&m*} "
#if defined(TARGET_VXWORKS_RTP)
from ARGV that it successfully decoded; 0 indicates failure. */
static int
-gnat_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
+gnat_handle_option (size_t scode, const char *arg, int value)
{
const struct cl_option *option = &cl_options[scode];
enum opt_code code = (enum opt_code) scode;
gnat_argc++;
break;
- /* All front ends are expected to accept this. */
case OPT_Wall:
+ set_Wunused (value);
+
+ /* We save the value of warn_uninitialized, since if they put
+ -Wuninitialized on the command line, we need to generate a
+ warning about not using it without also specifying -O. */
+ if (warn_uninitialized != 1)
+ warn_uninitialized = (value ? 2 : 0);
+ break;
+
/* These are used in the GCC Makefile. */
case OPT_Wmissing_prototypes:
case OPT_Wstrict_prototypes:
bool
gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
{
+ /* ??? The warning machinery is outsmarted by Ada. */
+ warn_unused_parameter = 0;
+
flag_inline_trees = 1;
if (!flag_no_inline)
+2008-03-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/uninit_func.adb: New test.
+
2008-03-08 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/pack4.adb: New test.
--- /dev/null
+-- { dg-do compile }
+-- { dg-options "-O -Wall" }
+
+function uninit_func (A, B : Boolean) return Boolean is
+ C : Boolean; -- { dg-warning "may be used uninitialized" }
+begin
+ if A then
+ C := False;
+ elsif B then
+ C := True;
+ end if;
+ return C;
+end;