diff options
author | marcel <marcel@FreeBSD.org> | 2014-11-18 18:03:40 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2014-11-18 18:03:40 +0000 |
commit | 529a1bcd76a13b638d96ee42dfae18aed336c67f (patch) | |
tree | 890e58d69193cd818d17ec5c1e3aed170d0d975f /contrib/libxo/xolint | |
parent | 76ed0e540b3cf5895a201aff9b674c4a99e8ecaa (diff) | |
download | FreeBSD-src-529a1bcd76a13b638d96ee42dfae18aed336c67f.zip FreeBSD-src-529a1bcd76a13b638d96ee42dfae18aed336c67f.tar.gz |
Upgrade libxo to 0.1.6.
Summary of changes:
1. Coverity defect fixes
Obtained from: https://github.com/Juniper/libxo/releases/tag/0.1.6
Diffstat (limited to 'contrib/libxo/xolint')
-rwxr-xr-x | contrib/libxo/xolint/xolint.pl | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/contrib/libxo/xolint/xolint.pl b/contrib/libxo/xolint/xolint.pl index 8693e62..427edf7 100755 --- a/contrib/libxo/xolint/xolint.pl +++ b/contrib/libxo/xolint/xolint.pl @@ -28,6 +28,19 @@ sub main { extract_samples() if /^-X/; } + if ($#ARGV < 0) { + print STDERR "xolint [options] files ...\n"; + print STDERR " -c invoke 'cpp' on input\n"; + print STDERR " -C flags Pass flags to cpp\n"; + print STDERR " -d Show debug output\n"; + print STDERR " -D Extract xolint documentation\n"; + print STDERR " -I Print xo_info_t data\n"; + print STDERR " -p Print input data on errors\n"; + print STDERR " -V Print vocabulary (list of tags)\n"; + print STDERR " -X Print examples of invalid use\n"; + exit(1); + } + for $file (@ARGV) { parse_file($file); } @@ -269,9 +282,9 @@ sub check_format { $last = $prev; next; } + $prev = $ch; } - $prev = $ch; $build[$phase] .= $ch; } @@ -346,18 +359,6 @@ sub check_field { info("potential missing slash after N, L, or T with format") if $field[1] =~ /%/; - #@ Format cannot be given when content is present (roles: DNLT) - #@ xo_emit("{T:Max/%6.6s}", "Max"); - #@ Fields with the D, N, L, or T roles can't have both - #@ static literal content ("{T:Title}") and a - #@ format ("{T:/%s}"). - #@ This error will also occur when the content has a backslash - #@ in it, like "{N:Type of I/O}"; backslashes should be escaped, - #@ like "{N:Type of I\\/O}". Note the double backslash, one for - #@ handling 'C' strings, and one for libxo. - error("format cannot be given when content is present") - if $field[1] && $field[2]; - #@ An encoding format cannot be given (roles: DNLT) #@ xo_emit("{T:Max//%s}", "Max"); #@ Fields with the D, N, L, and T roles are not emitted in @@ -367,6 +368,21 @@ sub check_field { if $field[3]; } + # Field is a decoration, label, or title + if ($field[0] =~ /DLN/) { + #@ Format cannot be given when content is present (roles: DLN) + #@ xo_emit("{N:Max/%6.6s}", "Max"); + #@ Fields with the D, L, or N roles can't have both + #@ static literal content ("{L:Label}") and a + #@ format ("{L:/%s}"). + #@ This error will also occur when the content has a backslash + #@ in it, like "{N:Type of I/O}"; backslashes should be escaped, + #@ like "{N:Type of I\\/O}". Note the double backslash, one for + #@ handling 'C' strings, and one for libxo. + error("format cannot be given when content is present") + if $field[1] && $field[2]; + } + # A value field if (length($field[0]) == 0 || $field[0] =~ /V/) { @@ -527,7 +543,7 @@ sub check_field_format { #@ for non-strings. This error may occur from a typo, #@ like "{:tag/%6..6d}" where only one period should be used. error("max width only valid for strings") - if $#chunks >= 2 && $fc =~ /[sS]/; + if $#chunks >= 2 && $fc !~ /[sS]/; } sub error { |