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 @@ -247,19 +247,30 @@ sub generate_proto_h {
247
247
unless $has_mflag ;
248
248
}
249
249
else {
250
- if ( $args_assert_line
251
- && $arg =~ / \* /
252
- && $arg !~ / \b (NN|NULLOK)\b / )
253
- {
254
- warn " $func : $arg needs NN or NULLOK\n " ;
255
- ++$unflagged_pointers ;
256
- }
257
-
258
250
my $nn = ( $arg =~ s /\s *\b NN\b\s +// );
259
251
my $nz = ( $arg =~ s /\s *\b NZ\b\s +// );
260
252
my $nullok = ( $arg =~ s /\s *\b NULLOK\b\s +// );
261
253
my $nocheck = ( $arg =~ s /\s *\b NOCHECK\b\s +// );
262
254
255
+ die_at_end " :$func : $arg Use only one of NN, NULLOK, and NZ"
256
+ if 0 + $nn + $nz + $nullok > 1;
257
+
258
+ push ( @nonnull , $n ) if $nn ;
259
+
260
+ # A non-pointer shouldn't have a pointer-related modifier.
261
+ # But typedefs may be pointers without our knowing it, so
262
+ # we can't check for non-pointer issues. We can only
263
+ # check for the case where the argument is definitely a
264
+ # pointer.
265
+ if ($args_assert_line && $arg =~ / \* / ) {
266
+ if ($nn + $nullok == 0) {
267
+ warn " $func : $arg needs NN or NULLOK\n " ;
268
+ ++$unflagged_pointers ;
269
+ }
270
+
271
+ warn " $func : $arg should not have NZ\n " if $nz ;
272
+ }
273
+
263
274
push ( @nonnull , $n ) if $nn ;
264
275
265
276
# 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