On 10/14/2010 06:19 AM, Pádraig Brady wrote:
@@ -3882,6 +3882,8 @@ parse_field_count (char const *string, size_t *val, char 
const *msgid)
      case LONGINT_OVERFLOW:
      case LONGINT_OVERFLOW | LONGINT_INVALID_SUFFIX_CHAR:
        *val = SIZE_MAX;
+      if (debug) /* Note --debug must come before keys to diagnose this.  */
+        error (0, 0, _("%" PRIuMAX " is too large, using %zu"), n, *val);
        break;

Rather than warn during option parsing, what if you instead set a bool variable overflow_detected, and warn only after option parsing is completed? The warning won't be quite as specific:

_("At least one key range overflowed")

but given that it's a corner case already, it means you would then have warning for:

sort +$(((1<<31)-1)) --debug

Just a thought; I'm okay with whatever you eventually commit on this front.

--
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



Reply via email to