File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed
Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -256,14 +256,6 @@ sub generate_proto_h {
256256 unless $has_mflag ;
257257 }
258258 else {
259- if ( $args_assert_line
260- && $arg =~ / \* /
261- && $arg !~ / \b (NN|NULLOK)\b / )
262- {
263- warn " $func : $arg needs NN or NULLOK\n " ;
264- ++$unflagged_pointers ;
265- }
266-
267259 my $nn = ( $arg =~ s /\b NN\b // );
268260 my $nz = ( $arg =~ s /\b NZ\b // );
269261 my $nullok = ( $arg =~ s /\b NULLOK\b // );
@@ -274,6 +266,25 @@ sub generate_proto_h {
274266 $arg =~ s /\s +$// ;
275267 $arg =~ s /\s {2,}/ / g ;
276268
269+ die_at_end " :$func : $arg Use only one of NN, NULLOK, and NZ"
270+ if 0 + $nn + $nz + $nullok > 1;
271+
272+ push ( @nonnull , $n ) if $nn ;
273+
274+ # A non-pointer shouldn't have a pointer-related modifier.
275+ # But typedefs may be pointers without our knowing it, so
276+ # we can't check for non-pointer issues. We can only
277+ # check for the case where the argument is definitely a
278+ # pointer.
279+ if ($args_assert_line && $arg =~ / \* / ) {
280+ if ($nn + $nullok == 0) {
281+ warn " $func : $arg needs NN or NULLOK\n " ;
282+ ++$unflagged_pointers ;
283+ }
284+
285+ warn " $func : $arg should not have NZ\n " if $nz ;
286+ }
287+
277288 push ( @nonnull , $n ) if $nn ;
278289
279290 # Make sure each arg has at least a type and a var name.
You can’t perform that action at this time.
0 commit comments