mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
maint: avoid further typedef accidents
To make it easier to forbid future attempts at a confusing typedef name ending in Ptr that isn't actually a pointer, insist that we follow our preferred style of 'typedef foo *fooPtr'. * cfg.mk (sc_forbid_const_pointer_typedef): Enforce consistent style, to prevent issue fixed in previous storage patch. * src/conf/capabilities.h (virCapsPtr): Fix offender. * src/security/security_stack.c (virSecurityStackItemPtr): Likewise. * tests/qemucapabilitiestest.c (testQemuDataPtr): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
5eb3dff5b6
commit
fb8613525d
4
cfg.mk
4
cfg.mk
@ -471,10 +471,14 @@ sc_correct_id_types:
|
||||
# "const fooPtr a" is the same as "foo * const a", even though it is
|
||||
# usually desired to have "foo const *a". It's easier to just prevent
|
||||
# the confusing mix of typedef vs. const placement.
|
||||
# Also requires that all 'fooPtr' typedefs are actually pointers.
|
||||
sc_forbid_const_pointer_typedef:
|
||||
@prohibit='(^|[^"])const \w*Ptr' \
|
||||
halt='"const fooPtr var" does not declare what you meant' \
|
||||
$(_sc_search_regexp)
|
||||
@prohibit='typedef [^(]+ [^*]\w*Ptr\b' \
|
||||
halt='use correct style and type for Ptr typedefs' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Forbid sizeof foo or sizeof (foo), require sizeof(foo)
|
||||
sc_size_of_brackets:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* capabilities.h: hypervisor capabilities
|
||||
*
|
||||
* Copyright (C) 2006-2008, 2010, 2012 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2013 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2008 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
Loading…
Reference in New Issue
Block a user