[glib/glib-2-30] goption: try to be helpful in goption args/flag checks



commit fa161472eb3b77000d0218f689a10fca36629b18
Author: Stefan Sauer <ensonic users sf net>
Date:   Sun Feb 26 21:20:24 2012 +0100

    goption: try to be helpful in goption args/flag checks
    
    When complaining about ill defined GOptionEntries include the name of the option
    group and entry in the warning.

 glib/goption.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/glib/goption.c b/glib/goption.c
index 07a06b5..6c0b308 100644
--- a/glib/goption.c
+++ b/glib/goption.c
@@ -2179,14 +2179,16 @@ g_option_group_add_entries (GOptionGroup       *group,
 
       if (c == '-' || (c != 0 && !g_ascii_isprint (c)))
         {
-          g_warning (G_STRLOC ": ignoring invalid short option '%c' (%d)", c, c);
-          group->entries[i].short_name = 0;
+          g_warning (G_STRLOC ": ignoring invalid short option '%c' (%d) in entry %s:%s",
+              c, c, group->name, group->entries[i].long_name);
+          group->entries[i].short_name = '\0';
         }
 
       if (group->entries[i].arg != G_OPTION_ARG_NONE &&
           (group->entries[i].flags & G_OPTION_FLAG_REVERSE) != 0)
         {
-          g_warning (G_STRLOC ": ignoring reverse flag on option of type %d", group->entries[i].arg);
+          g_warning (G_STRLOC ": ignoring reverse flag on option of arg-type %d in entry %s:%s",
+              group->entries[i].arg, group->name, group->entries[i].long_name);
 
           group->entries[i].flags &= ~G_OPTION_FLAG_REVERSE;
         }
@@ -2194,7 +2196,8 @@ g_option_group_add_entries (GOptionGroup       *group,
       if (group->entries[i].arg != G_OPTION_ARG_CALLBACK &&
           (group->entries[i].flags & (G_OPTION_FLAG_NO_ARG|G_OPTION_FLAG_OPTIONAL_ARG|G_OPTION_FLAG_FILENAME)) != 0)
         {
-          g_warning (G_STRLOC ": ignoring no-arg, optional-arg or filename flags (%d) on option of type %d", group->entries[i].flags, group->entries[i].arg);
+          g_warning (G_STRLOC ": ignoring no-arg, optional-arg or filename flags (%d) on option of arg-type %d in entry %s:%s",
+              group->entries[i].flags, group->entries[i].arg, group->name, group->entries[i].long_name);
 
           group->entries[i].flags &= ~(G_OPTION_FLAG_NO_ARG|G_OPTION_FLAG_OPTIONAL_ARG|G_OPTION_FLAG_FILENAME);
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]