Hi all,

I have slightly updated the patch now to avoid string-breaking issues
(even if it may not be a problem at all, as mentioned by Jospeh). Also
I removed the questionable part in intrinsic.c that I was not sure
about.

This version of the patch should not be too far from obvious now. Ok for trunk?

Cheers,
Janus



2016-02-03 23:27 GMT+01:00 Joseph Myers <jos...@codesourcery.com>:
> On Wed, 3 Feb 2016, Manfred Schwarb wrote:
>
>> There are 2 things with translation, and there is a third issue:
>> - As you noticed, breaking things differently means translation has to be
>>   done again.
>> - Normally, each string is translated independently, and depending on the
>>   language there may be lack of context (e.g. adjectives get different
>> suffixes
>>   depending on the noun).
>
> I believe gettext works fine with (compile-time) string constant
> concatenation - that is, extracts the whole concatenated string for
> translation, so these are non-issues.  What doesn't work includes:
>
> * Runtime concatenation of strings or otherwise putting English fragments
> together at runtime.
>
> * String constant concatenation where one of the concatenated pieces comes
> from a macro expansion.
>
> * The argument for translation being a conditional expression:
>
>   error (cond ? "message 1" : "message 2");
>
> (in this case, only one of the messages may be extracted for translation,
> so you need to mark both of them up with appropriate macros such as G_).
>
> --
> Joseph S. Myers
> jos...@codesourcery.com
Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c (Revision 233182)
+++ gcc/fortran/check.c (Arbeitskopie)
@@ -5180,7 +5180,8 @@ gfc_check_transfer (gfc_expr *source, gfc_expr *mo
     return true;
 
   if (source_size < result_size)
-    gfc_warning (0, "Intrinsic TRANSFER at %L has partly undefined result: "
+    gfc_warning (OPT_Wsurprising,
+                "Intrinsic TRANSFER at %L has partly undefined result: "
                 "source size %ld < result size %ld", &source->where,
                 (long) source_size, (long) result_size);
 
Index: gcc/fortran/frontend-passes.c
===================================================================
--- gcc/fortran/frontend-passes.c       (Revision 233182)
+++ gcc/fortran/frontend-passes.c       (Arbeitskopie)
@@ -715,10 +715,12 @@ do_warn_function_elimination (gfc_expr *e)
   if (e->expr_type != EXPR_FUNCTION)
     return;
   if (e->value.function.esym)
-    gfc_warning (0, "Removing call to function %qs at %L",
+    gfc_warning (OPT_Wfunction_elimination,
+                "Removing call to function %qs at %L",
                 e->value.function.esym->name, &(e->where));
   else if (e->value.function.isym)
-    gfc_warning (0, "Removing call to function %qs at %L",
+    gfc_warning (OPT_Wfunction_elimination,
+                "Removing call to function %qs at %L",
                 e->value.function.isym->name, &(e->where));
 }
 /* Callback function for the code walker for doing common function
Index: gcc/fortran/invoke.texi
===================================================================
--- gcc/fortran/invoke.texi     (Revision 233182)
+++ gcc/fortran/invoke.texi     (Arbeitskopie)
@@ -709,8 +709,10 @@ Check the code for syntax errors, but do not actua
 will generate module files for each module present in the code, but no
 other output file.
 
-@item -pedantic
+@item -Wpedantic
+@itemx -pedantic
 @opindex @code{pedantic}
+@opindex @code{Wpedantic}
 Issue warnings for uses of extensions to Fortran 95.
 @option{-pedantic} also applies to C-language constructs where they
 occur in GNU Fortran source files, such as use of @samp{\e} in a
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (Revision 233182)
+++ gcc/fortran/resolve.c       (Arbeitskopie)
@@ -2127,7 +2127,8 @@ resolve_elemental_actual (gfc_expr *expr, gfc_code
          && (set_by_optional || arg->expr->rank != rank)
          && !(isym && isym->id == GFC_ISYM_CONVERSION))
        {
-         gfc_warning (0, "%qs at %L is an array and OPTIONAL; IF IT IS "
+         gfc_warning (OPT_Wpedantic,
+                      "%qs at %L is an array and OPTIONAL; IF IT IS "
                       "MISSING, it cannot be the actual argument of an "
                       "ELEMENTAL procedure unless there is a non-optional "
                       "argument with the same rank (12.4.1.5)",
@@ -3685,7 +3686,8 @@ resolve_operator (gfc_expr *e)
                  else
                    msg = "Inequality comparison for %s at %L";
 
-                 gfc_warning (0, msg, gfc_typename (&op1->ts), &op1->where);
+                 gfc_warning (OPT_Wcompare_reals, msg,
+                              gfc_typename (&op1->ts), &op1->where);
                }
            }
 
@@ -14890,12 +14892,13 @@ warn_unused_fortran_label (gfc_st_label *label)
   switch (label->referenced)
     {
     case ST_LABEL_UNKNOWN:
-      gfc_warning (0, "Label %d at %L defined but not used", label->value,
-                  &label->where);
+      gfc_warning (OPT_Wunused_label, "Label %d at %L defined but not used",
+                  label->value, &label->where);
       break;
 
     case ST_LABEL_BAD_TARGET:
-      gfc_warning (0, "Label %d at %L defined but cannot be used",
+      gfc_warning (OPT_Wunused_label,
+                  "Label %d at %L defined but cannot be used",
                   label->value, &label->where);
       break;
 
Index: gcc/fortran/trans-common.c
===================================================================
--- gcc/fortran/trans-common.c  (Revision 233182)
+++ gcc/fortran/trans-common.c  (Arbeitskopie)
@@ -1138,13 +1138,13 @@ translate_common (gfc_common_head *common, gfc_sym
              if (warn_align_commons)
                {
                  if (strcmp (common->name, BLANK_COMMON_NAME))
-                   gfc_warning (0,
+                   gfc_warning (OPT_Walign_commons,
                                 "Padding of %d bytes required before %qs in "
                                 "COMMON %qs at %L; reorder elements or use "
                                 "-fno-align-commons", (int)offset,
                                 s->sym->name, common->name, &common->where);
                  else
-                   gfc_warning (0,
+                   gfc_warning (OPT_Walign_commons,
                                 "Padding of %d bytes required before %qs in "
                                 "COMMON at %L; reorder elements or use "
                                 "-fno-align-commons", (int)offset,
Index: gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90
===================================================================
--- gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90     (Revision 
233182)
+++ gcc/testsuite/gfortran.dg/elemental_optional_args_6.f90     (Arbeitskopie)
@@ -1,4 +1,5 @@
 ! { dg-do run }
+! { dg-options "-Wpedantic" }
 !
 ! PR fortran/53692
 !

Reply via email to