Commit Graph

9 Commits

Author SHA1 Message Date
H. Peter Anvin (Intel)
ad1f50a506 warnings.pl: remove one more instance of "scalar(%hash)"
scalar(%hash) is broken on old versions of Perl, use scalar(keys
%hash).

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 16:20:40 -07:00
H. Peter Anvin (Intel)
d73b10abd5 warnings.pl: BR 3392585: don't use scalar(%hash)
The idiom scalar(%hash) seems similar to scalar(@array), and in fact
is in current versions of Perl. However, in older versions of Perl,
the former is totally useless:

       Prior to Perl 5.25 the value returned was a string consisting
       of the number of used buckets and the number of allocated
       buckets, separated by a slash.  This is pretty much useful only
       to find out whether Perl's internal hashing algorithm is
       performing poorly on your data set.  For example, you stick
       10,000 things in a hash, but evaluating %HASH in scalar context
       reveals "1/16", which means only one out of sixteen buckets has
       been touched, and presumably contains all 10,000 of your items.
       This isn't supposed to happen.

       As of Perl 5.25 the return was changed to be the count of keys
       in the hash. If you need access to the old behavior you can use
       "Hash::Util::bucket_ratio()" instead.

Use scalar(keys %hash) instead.

Reported-by: Orkan Sezer <sezeroz@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 13:45:41 -07:00
H. Peter Anvin (Intel)
177a05d0ce perl files: clean up warnings
Clean up some perl warnings, some of which were legitimate (apparently
undef doesn't actually take a list of arguments, a common enough
mistake that it is mentioned in the man page!, and a list of variables
after "my" can be cantankerous), and some of which were nuisance but
were easy enough to clean up.

Maybe this can resolve the problems with very old version of Perl?

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 13:30:19 -07:00
H. Peter Anvin (Intel)
ca47c843ed warnings.pl: move comment
Move a comment to where it makes more sense.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-06 19:30:36 -07:00
H. Peter Anvin (Intel)
65c958d59f warnings.pl: warn on duplicate definition instead of broken output
Have warnings.pl give a warning(!) message if a warning definition is
found to be duplicated, including the location of both
definitions. Much better than silently creating bogus output.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-06 19:28:57 -07:00
H. Peter Anvin
fdeb3b0d01 Add group aliases for all prefixed warnings.
For example, -w+float will now enable all warnings with names staring
with float-*.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2019-06-06 20:53:17 -07:00
H. Peter Anvin (Intel)
1df7263ae9 warnings: add [warning push] and [warning pop]
Add [warning push] and [warning pop] directives.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-01-11 13:13:03 -08:00
H. Peter Anvin (Intel)
723ab481a6 warnings: define warning classes at point of use
It is extremely desirable to allow the user fine-grained control of
warnings, but this has been complicated by the fact that a warning
class has had to be defined in no less than three places (error.h,
error.c, nasmdoc.src) before it can be used in source code. Instead,
use a script to define these via magic comments at the point of use.

This hopefully will encourage creating new classes as needed.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 21:53:31 -08:00
H. Peter Anvin (Intel)
3c896de5a3 warnings.pl: script to harvest warnings directly from the source
This will make it a lot easier to create new warning categories by
inserting a block comment directly in the source code near where the
warning is used.

This block comment should look like:

     /*
      *!warning-name {on|off|err} this is a warning
      *!
      *! needs a help text.
      */
      nasm_warnf(WARN_WARNING_NAME, ...);

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 16:33:39 -08:00