1 # Customize Makefile.maint. -*- makefile -*-
2 # Copyright (C) 2008-2019 Red Hat, Inc.
3 # Copyright (C) 2003-2008 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see
17 # <http://www.gnu.org/licenses/>.
19 # Use alpha.gnu.org for alpha and beta releases.
20 # Use ftp.gnu.org for major releases.
21 gnu_ftp_host-alpha
= alpha.gnu.org
22 gnu_ftp_host-beta
= alpha.gnu.org
23 gnu_ftp_host-major
= ftp.gnu.org
24 gnu_rel_host
= $(gnu_ftp_host-
$(RELEASE_TYPE
))
27 ftp
://$(gnu_rel_host
)/gnu
/coreutils
29 # We use .gnulib, not gnulib.
30 gnulib_dir
= $(srcdir)/.gnulib
32 # List of additional files that we want to pick up in our POTFILES.in
33 # This is all gnulib files, as well as generated files for RPC code.
35 $(srcdir)/src
/*/{remote_daemon
,admin_server
,log_daemon
,lock_daemon
}_dispatch_
*stubs.h \
36 $(srcdir)/src
/lxc
/{lxc_monitor
,lxc_controller
}_dispatch.h \
37 $(srcdir)/src
/remote
/*_client_bodies.h \
38 $(srcdir)/src
/*/*_protocol.
[ch
] \
39 $(srcdir)/gnulib
/lib
/*.
[ch
]
41 # We haven't converted all scripts to using gnulib's init.sh yet.
42 _test_script_regex
= \
<\
(init\|test-lib\
)\.sh\
>
44 # Tests not to run as part of "make distcheck".
45 local-checks-to-skip
= \
48 makefile_path_separator_check \
51 sc_always_defined_macros \
52 sc_cast_of_alloca_return_value \
53 sc_cross_check_PATH_usage_in_tests \
54 sc_dd_max_sym_length \
55 sc_error_exit_success \
58 sc_makefile_path_separator_check \
60 sc_prohibit_S_IS_definition \
61 sc_prohibit_atoi_atof \
62 sc_prohibit_hash_without_use \
63 sc_prohibit_jm_in_m4 \
64 sc_prohibit_quote_without_use \
65 sc_prohibit_quotearg_without_use \
66 sc_prohibit_stat_st_blocks \
67 sc_prohibit_undesirable_word_seq \
74 sc_two_space_separator_in_usage \
75 sc_error_message_uppercase \
77 sc_require_test_exit_idiom \
81 # Most developers don't run 'make distcheck'. We want the official
82 # dist to be secure, but don't want to penalize other developers
83 # using a distro that has not yet picked up the automake fix.
84 # FIXME remove this ifeq (making the syntax check unconditional)
85 # once fixed automake (1.11.6 or 1.12.2+) is more common.
86 ifeq ($(filter dist%, $(MAKECMDGOALS
)), )
87 local-checks-to-skip
+= sc_vulnerable_makefile_CVE-2012-3386
89 distdir
: sc_vulnerable_makefile_CVE-2012-3386.z
92 # Files that should never cause syntax check failures.
93 VC_LIST_ALWAYS_EXCLUDE_REGEX
= \
94 (^
(docs
/(news
(-[0-9]*)?\.html\.in|.
*\.patch
))|\.
(po|fig|gif|ico|png
))$$
96 # Functions like free() that are no-ops on NULL arguments.
97 useless_free_options
= \
98 --name
=VBOX_UTF16_FREE \
99 --name
=VBOX_UTF8_FREE \
100 --name
=VBOX_COM_UNALLOC_MEM \
102 --name
=qemuCapsFree \
103 --name
=qemuMigrationCookieFree \
104 --name
=qemuMigrationCookieGraphicsFree \
106 --name
=usbFreeDevice \
107 --name
=virBandwidthDefFree \
108 --name
=virBitmapFree \
109 --name
=virCPUDefFree \
110 --name
=virCapabilitiesFree \
111 --name
=virCapabilitiesFreeGuest \
112 --name
=virCapabilitiesFreeGuestDomain \
113 --name
=virCapabilitiesFreeGuestFeature \
114 --name
=virCapabilitiesFreeGuestMachine \
115 --name
=virCapabilitiesFreeHostNUMACell \
116 --name
=virCapabilitiesFreeMachines \
117 --name
=virCgroupFree \
118 --name
=virCommandFree \
119 --name
=virConfFreeList \
120 --name
=virConfFreeValue \
121 --name
=virDomainActualNetDefFree \
122 --name
=virDomainChrDefFree \
123 --name
=virDomainControllerDefFree \
124 --name
=virDomainDefFree \
125 --name
=virDomainDeviceDefFree \
126 --name
=virDomainDiskDefFree \
127 --name
=virDomainEventCallbackListFree \
128 --name
=virObjectEventQueueFree \
129 --name
=virDomainFSDefFree \
130 --name
=virDomainGraphicsDefFree \
131 --name
=virDomainHostdevDefFree \
132 --name
=virDomainInputDefFree \
133 --name
=virDomainNetDefFree \
134 --name
=virDomainObjFree \
135 --name
=virDomainSmartcardDefFree \
136 --name
=virDomainSnapshotObjFree \
137 --name
=virDomainSoundDefFree \
138 --name
=virDomainVideoDefFree \
139 --name
=virDomainWatchdogDefFree \
140 --name
=virFileDirectFdFree \
142 --name
=virInterfaceDefFree \
143 --name
=virInterfaceIpDefFree \
144 --name
=virInterfaceObjFree \
145 --name
=virInterfaceProtocolDefFree \
146 --name
=virJSONValueFree \
147 --name
=virLastErrFreeData \
148 --name
=virNetMessageFree \
149 --name
=virNetServerMDNSFree \
150 --name
=virNetServerMDNSEntryFree \
151 --name
=virNetServerMDNSGroupFree \
152 --name
=virNWFilterDefFree \
153 --name
=virNWFilterEntryFree \
154 --name
=virNWFilterHashTableFree \
155 --name
=virNWFilterIPAddrLearnReqFree \
156 --name
=virNWFilterIncludeDefFree \
157 --name
=virNWFilterObjFree \
158 --name
=virNWFilterRuleDefFree \
159 --name
=virNWFilterRuleInstFree \
160 --name
=virNetworkDefFree \
161 --name
=virNodeDeviceDefFree \
162 --name
=virNodeDeviceObjFree \
163 --name
=virObjectUnref \
164 --name
=virObjectFreeCallback \
165 --name
=virPCIDeviceFree \
166 --name
=virSecretDefFree \
167 --name
=virStorageEncryptionFree \
168 --name
=virStorageEncryptionSecretFree \
169 --name
=virStorageFileFreeMetadata \
170 --name
=virStoragePoolDefFree \
171 --name
=virStoragePoolObjFree \
172 --name
=virStoragePoolSourceFree \
173 --name
=virStorageVolDefFree \
174 --name
=virThreadPoolFree \
175 --name
=xmlBufferFree \
179 --name
=xmlXPathFreeContext \
180 --name
=xmlXPathFreeObject
182 # The following template was generated by this command:
183 # make ID && aid free|grep '^vi'|sed 's/ .*//;s/^/# /'
184 # N virBufferFreeAndReset
186 # y virCapabilitiesFree
187 # y virCapabilitiesFreeGuest
188 # y virCapabilitiesFreeGuestDomain
189 # y virCapabilitiesFreeGuestFeature
190 # y virCapabilitiesFreeGuestMachine
191 # y virCapabilitiesFreeHostNUMACell
192 # y virCapabilitiesFreeMachines
193 # N virCapabilitiesFreeNUMAInfo FIXME
195 # N virConfFree (diagnoses the "error")
198 # y virDomainChrDefFree
199 # y virDomainControllerDefFree
201 # y virDomainDeviceDefFree
202 # y virDomainDiskDefFree
203 # y virDomainEventCallbackListFree
204 # y virDomainEventQueueFree
205 # y virDomainFSDefFree
207 # n virDomainFreeName (can't fix -- returns int)
208 # y virDomainGraphicsDefFree
209 # y virDomainHostdevDefFree
210 # y virDomainInputDefFree
211 # y virDomainNetDefFree
213 # n virDomainSnapshotFree (returns int)
214 # n virDomainSnapshotFreeName (returns int)
215 # y virDomainSnapshotObjFree
216 # y virDomainSoundDefFree
217 # y virDomainVideoDefFree
218 # y virDomainWatchdogDefFree
219 # n virDrvNodeGetCellsFreeMemory (returns int)
220 # n virDrvNodeGetFreeMemory (returns long long)
221 # n virFree - dereferences param
223 # n virHashFree (takes 2 args)
224 # y virInterfaceDefFree
225 # n virInterfaceFree (returns int)
226 # n virInterfaceFreeName
227 # y virInterfaceIpDefFree
228 # y virInterfaceObjFree
229 # n virInterfaceObjListFree
230 # y virInterfaceProtocolDefFree
232 # y virLastErrFreeData
233 # y virNWFilterDefFree
234 # y virNWFilterEntryFree
235 # n virNWFilterFree (returns int)
236 # y virNWFilterHashTableFree
237 # y virNWFilterIPAddrLearnReqFree
238 # y virNWFilterIncludeDefFree
239 # n virNWFilterFreeName (returns int)
240 # y virNWFilterObjFree
241 # n virNWFilterObjListFree FIXME
242 # y virNWFilterRuleDefFree
243 # n virNWFilterRuleFreeInstanceData (typedef)
244 # y virNWFilterRuleInstFree
245 # y virNetworkDefFree
246 # n virNetworkFree (returns int)
247 # n virNetworkFreeName (returns int)
248 # n virNodeDevCapsDefFree FIXME
249 # y virNodeDeviceDefFree
250 # n virNodeDeviceFree (returns int)
251 # y virNodeDeviceObjFree
252 # n virNodeDeviceObjListFree FIXME
253 # n virNodeGetCellsFreeMemory (returns int)
254 # n virNodeGetFreeMemory (returns non-void)
256 # n virSecretFree (returns non-void)
257 # n virSecretFreeName (2 args)
258 # n virSecurityLabelDefFree FIXME
259 # n virStorageBackendDiskMakeFreeExtent (returns non-void)
260 # y virStorageEncryptionFree
261 # y virStorageEncryptionSecretFree
262 # n virStorageFreeType (enum)
263 # y virStoragePoolDefFree
264 # n virStoragePoolFree (returns non-void)
265 # n virStoragePoolFreeName (returns non-void)
266 # y virStoragePoolObjFree
267 # n virStoragePoolObjListFree FIXME
268 # y virStoragePoolSourceFree
269 # y virStorageVolDefFree
270 # n virStorageVolFree (returns non-void)
271 # n virStorageVolFreeName (returns non-void)
274 # Avoid uses of write(2). Either switch to streams (fwrite), or use
275 # the safewrite wrapper.
277 @prohibit
='\<write *\(' \
278 in_vc_files
='\.c$$' \
279 halt
='consider using safewrite instead of write' \
282 # In debug statements, print flags as bitmask and mode_t as octal.
284 @prohibit
='\<mode=%[0-9.]*[diuxo]' \
285 halt
='use \"0%o\" to debug mode_t values' \
287 @prohibit
='[Ff]lags=%[0-9.]*l*[dioux]' \
288 halt
='use \"0x%x\" to debug flag values' \
291 # Prefer 'unsigned int flags', along with checks for unknown flags.
292 # For historical reasons, we are stuck with 'unsigned long flags' in
293 # migration, so check for those known 4 instances and no more in public
294 # API. Also check that no flags are marked unused, and 'unsigned' should
295 # appear before any declaration of a flags variable (achieved by
296 # prohibiting the word prior to the type from ending in anything other
297 # than d). The existence of long long, and of documentation about
298 # flags, makes the regex in the third test slightly harder.
300 @
test "$$(cat $(srcdir)/include/libvirt/libvirt-domain.h \
301 $(srcdir)/include/libvirt/virterror.h \
302 $(srcdir)/include/libvirt/libvirt-qemu.h \
303 $(srcdir)/include/libvirt/libvirt-lxc.h \
304 $(srcdir)/include/libvirt/libvirt-admin.h \
305 | $(GREP) -c '\(long\|unsigned\) flags')" != 4 && \
306 { echo
'$(ME): new API should use "unsigned int flags"' 1>&2; \
308 @prohibit
=' flags ATTRIBUTE_UNUSED' \
309 exclude
='virSecurityDomainImageLabelFlags' \
310 halt
='flags should be checked with virCheckFlags' \
312 @prohibit
='^[^@]*([^d] (int|long long)|[^dg] long) flags[;,)]' \
313 halt
='flags should be unsigned' \
316 # Avoid functions that should only be called via macro counterparts.
317 sc_prohibit_internal_functions
:
318 @prohibit
='vir(Free|AllocN?|ReallocN|(Insert|Delete)ElementsN|File(Close|Fclose|Fdopen)) *\(' \
319 halt
='use VIR_ macros instead of internal functions' \
322 sc_prohibit_raw_virclassnew
:
323 @prohibit
='virClassNew *\(' \
324 halt
='use VIR_CLASS_NEW instead of virClassNew' \
327 # Avoid raw malloc and free, except in documentation comments.
328 sc_prohibit_raw_allocation
:
329 @prohibit
='^.[^*].*\<((m|c|re)alloc|free) *\([^)]' \
330 halt
='use VIR_ macros from viralloc.h instead of malloc/free' \
333 # Avoid functions that can lead to double-close bugs.
335 @prohibit
='([^>.]|^)\<[fp]?close *\(' \
336 halt
='use VIR_{FORCE_}[F]CLOSE instead of [f]close' \
338 @prohibit
='\<fdopen *\(' \
339 halt
='use VIR_FDOPEN instead of fdopen' \
342 # Prefer virCommand for all child processes.
343 sc_prohibit_fork_wrappers
:
344 @prohibit
='= *\<(fork|popen|system) *\(' \
345 halt
='use virCommand for child processes' \
348 # Prefer mkostemp with O_CLOEXEC.
350 @prohibit
='[^"]\<mkstemps? *\(' \
351 halt
='use mkostemp with O_CLOEXEC instead of mkstemp' \
354 # access with X_OK accepts directories, but we can't exec() those.
355 # access with F_OK or R_OK is okay, though.
356 sc_prohibit_access_xok
:
357 @prohibit
='access(at)? *\(.*X_OK' \
358 halt
='use virFileIsExecutable instead of access(,X_OK)' \
361 # Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
362 # Use STREQLEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
363 snp_
= strncmp
*\
(.
+\
)
365 @prohibit
='! *strncmp *\(|\<$(snp_) *[!=]=|[!=]= *$(snp_)' \
366 exclude
=':# *define STR(N?EQLEN|PREFIX)\(' \
367 halt
='use STREQLEN or STRPREFIX instead of strncmp' \
370 # strtol and friends are too easy to misuse
372 @prohibit
='\bstrto(u?ll?|[ui]max) *\(' \
373 exclude
='exempt from syntax-check' \
374 halt
='use virStrToLong_*, not strtol variants' \
376 @prohibit
='\bstrto[df] *\(' \
377 exclude
='exempt from syntax-check' \
378 halt
='use virStrToDouble, not strtod variants' \
381 # Use virAsprintf rather than as'printf since *strp is undefined on error.
382 # But for plain %s, virAsprintf is overkill compared to strdup.
383 sc_prohibit_asprintf
:
384 @prohibit
='\<v?a[s]printf\>' \
385 halt
='use virAsprintf, not asprintf' \
387 @prohibit
='virAsprintf.*, *"%s",' \
388 halt
='use VIR_STRDUP instead of virAsprintf with "%s"' \
392 @prohibit
='\<strn?dup\> *\(' \
393 halt
='use VIR_STRDUP, not strdup' \
396 # Prefer virSetUIDGID.
398 @prohibit
='\<set(re)?[ug]id\> *\(' \
399 halt
='use virSetUIDGID, not raw set*id' \
402 # Don't compare *id_t against raw -1.
403 sc_prohibit_risky_id_promotion
:
404 @prohibit
='\b(user|group|[ug]id) *[=!]= *-' \
405 halt
='cast -1 to ([ug]id_t) before comparing against id' \
408 # Use snprintf rather than s'printf, even if buffer is provably large enough,
409 # since gnulib has more guarantees for snprintf portability
411 @prohibit
='\<[s]printf\>' \
412 halt
='use snprintf, not sprintf' \
415 sc_prohibit_readlink
:
416 @prohibit
='\<readlink *\(' \
417 halt
='use virFileResolveLink, not readlink' \
420 sc_prohibit_gethostname
:
421 @prohibit
='gethostname *\(' \
422 halt
='use virGetHostname, not gethostname' \
426 @prohibit
='\b(read|close|open)dir *\(' \
427 exclude
='exempt from syntax-check' \
428 halt
='use virDirOpen, virDirRead and VIR_DIR_CLOSE' \
431 sc_prohibit_gettext_noop
:
432 @prohibit
='gettext_noop *\(' \
433 halt
='use N_, not gettext_noop' \
436 sc_prohibit_VIR_ERR_NO_MEMORY
:
437 @prohibit
='\<VIR_ERR_NO_MEMORY\>' \
438 halt
='use virReportOOMError, not VIR_ERR_NO_MEMORY' \
441 sc_prohibit_PATH_MAX
:
442 @prohibit
='\<PATH_MAX\>' \
443 halt
='dynamically allocate paths, do not use PATH_MAX' \
446 include $(srcdir)/Makefile.nonreentrant
447 sc_prohibit_nonreentrant
:
448 @prohibit
="\\<(${NON_REENTRANT_RE}) *\\(" \
449 halt
="use re-entrant functions (usually ending with _r)" \
453 @prohibit
='\<select *\(' \
454 halt
='use poll(), not select()' \
457 # Prohibit the inclusion of <ctype.h>.
459 @prohibit
='^# *include *<ctype\.h>' \
460 halt
='use c-ctype.h instead of ctype.h' \
463 # We have our own wrapper for mocking purposes
464 sc_prohibit_canonicalize_file_name
:
465 @prohibit
='\<canonicalize_file_name\(' \
466 exclude
='exempt from syntax-check' \
467 halt
='use virFileCanonicalizePath() instead of canonicalize_file_name()' \
470 # Insist on correct types for [pug]id.
472 @prohibit
='\<(int|long) *[pug]id\>' \
473 exclude
='exempt from syntax-check' \
474 halt
='use pid_t for pid, uid_t for uid, gid_t for gid' \
477 # "const fooPtr a" is the same as "foo * const a", even though it is
478 # usually desired to have "foo const *a". It's easier to just prevent
479 # the confusing mix of typedef vs. const placement.
480 # Also requires that all 'fooPtr' typedefs are actually pointers.
481 sc_forbid_const_pointer_typedef
:
482 @prohibit
='(^|[^"])const \w*Ptr' \
483 halt
='"const fooPtr var" does not declare what you meant' \
485 @prohibit
='typedef [^(]+ [^*]\w*Ptr\b' \
486 halt
='use correct style and type for Ptr typedefs' \
489 # Forbid sizeof foo or sizeof (foo), require sizeof(foo)
491 @prohibit
='sizeof\s' \
492 halt
='use sizeof(foo), not sizeof (foo) or sizeof foo' \
495 # Ensure that no C source file, docs, or rng schema uses TABs for
496 # indentation. Also match *.h.in files, to get libvirt.h.in. Exclude
497 # files in gnulib, since they're imported.
498 space_indent_files
=(\.
(aug
(\.in
)?|rng|s?
[ch
](\.in
)?|html.in|py|pl|syms
)|
(daemon|tools
)/.
*\.in
)
499 sc_TAB_in_indentation
:
501 in_vc_files
='$(space_indent_files)$$' \
502 halt
='indent with space, not TAB, in C, sh, html, py, syms and RNG schemas' \
505 ctype_re
= isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
506 |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
508 sc_avoid_ctype_macros
:
509 @prohibit
='\b($(ctype_re)) *\(' \
510 in_vc_files
='\.[ch]$$' \
511 halt
='use c-ctype.h instead of ctype macros' \
515 @prohibit
='\bstrn?case(cmp|str) *\(' \
516 halt
='use c-strcase.h instead of raw strcase functions' \
519 sc_prohibit_virBufferAdd_with_string_literal
:
520 @prohibit
='\<virBufferAdd *\([^,]+, *"[^"]' \
521 halt
='use virBufferAddLit, not virBufferAdd, with a string literal' \
524 sc_prohibit_virBufferAsprintf_with_string_literal
:
525 @prohibit
='\<virBufferAsprintf *\([^,]+, *"([^%"\]|\\.|%%)*"\)' \
526 halt
='use virBufferAddLit, not virBufferAsprintf, with a string literal' \
529 sc_forbid_manual_xml_indent
:
530 @prohibit
='virBuffer.*" +<' \
531 halt
='use virBufferAdjustIndent instead of spaces when indenting xml' \
534 # dirname and basename from <libgen.h> are not required to be thread-safe
536 @prohibit
='( (base|dir)name *\(|include .libgen\.h)' \
537 halt
='use functions from gnulib "dirname.h", not <libgen.h>' \
540 # raw xmlGetProp requires some nasty casts
541 sc_prohibit_xmlGetProp
:
542 @prohibit
='\<xmlGetProp *\(' \
543 halt
='use virXMLPropString, not xmlGetProp' \
546 # xml(ParseURI|SaveUri) doesn't handle IPv6 URIs well
548 @prohibit
='\<xml(ParseURI|SaveUri) *\(' \
549 halt
='use virURI(Parse|Format), not xml(ParseURI|SaveUri)' \
552 # we don't want old old-style return with parentheses around argument
553 sc_prohibit_return_as_function
:
554 @prohibit
='\<return *\(([^()]*(\([^()]*\)[^()]*)*)\) *;' \
555 halt
='avoid extra () with return statements' \
558 # ATTRIBUTE_UNUSED should only be applied in implementations, not
559 # header declarations
560 sc_avoid_attribute_unused_in_header
:
561 @prohibit
='^[^#]*ATTRIBUTE_UNUSED([^:]|$$)' \
562 in_vc_files
='\.h$$' \
563 halt
='use ATTRIBUTE_UNUSED in .c rather than .h files' \
566 sc_prohibit_int_index
:
567 @prohibit
='\<(int|unsigned)\s*\*?index\>(\s|,|;)' \
568 halt
='use different name than 'index
' for declaration' \
572 @prohibit
='\<(int|unsigned) ([^(=]* )*(i|j|k)\>(\s|,|;)' \
573 exclude
='exempt from syntax-check' \
574 halt
='use size_t, not int/unsigned int for loop vars i, j, k' \
577 sc_prohibit_loop_iijjkk
:
578 @prohibit
='\<(int|unsigned) ([^=]+ )*(ii|jj|kk)\>(\s|,|;)' \
579 halt
='use i, j, k for loop iterators, not ii, jj, kk' \
582 # RHEL 5 gcc can't grok "for (int i..."
583 sc_prohibit_loop_var_decl
:
584 @prohibit
='\<for *\(\w+[ *]+\w+' \
585 in_vc_files
='\.[ch]$$' \
586 halt
='declare loop iterators outside the for statement' \
589 # Use 'bool', not 'int', when assigning true or false
590 sc_prohibit_int_assign_bool
:
591 @prohibit
='\<int\>.*= *(true|false)' \
592 halt
='use bool type for boolean values' \
595 sc_prohibit_unsigned_pid
:
596 @prohibit
='\<unsigned\> [^,=;(]+pid' \
597 halt
='use signed type for pid values' \
600 # Many of the function names below came from this filter:
601 # git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
602 # |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \
603 # |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
606 msg_gen_function
+= VIR_ERROR
607 msg_gen_function
+= lxcError
608 msg_gen_function
+= regerror
609 msg_gen_function
+= vah_error
610 msg_gen_function
+= vah_warning
611 msg_gen_function
+= virGenericReportError
612 msg_gen_function
+= virRaiseError
613 msg_gen_function
+= virReportError
614 msg_gen_function
+= virReportErrorHelper
615 msg_gen_function
+= virReportSystemError
616 msg_gen_function
+= xenapiSessionErrorHandler
618 # Uncomment the following and run "make syntax-check" to see diagnostics
619 # that are not yet marked for translation, but that need to be rewritten
620 # so that they are translatable.
621 # msg_gen_function += fprintf
622 # msg_gen_function += testError
623 # msg_gen_function += vshPrint
624 # msg_gen_function += vshError
628 func_re
= ($(subst $(space
),|
,$(msg_gen_function
)))
630 # Look for diagnostics that aren't marked for translation.
631 # This won't find any for which error's format string is on a separate line.
632 # The sed filters eliminate false-positives like these:
634 # "%s", _("no storage vol w..."
635 sc_libvirt_unmarked_diagnostics
:
636 @prohibit
='\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' \
638 halt
='found unmarked diagnostic(s)' \
640 @
{ $(VC_LIST_EXCEPT
) | xargs \
641 $(GREP
) -nE
'\<$(func_re) *\(.*;$$' /dev
/null
; \
642 $(VC_LIST_EXCEPT
) | xargs \
643 $(GREP
) -A1
-nE
'\<$(func_re) *\(.*,$$' /dev
/null
; } \
644 |
$(SED
) -E
's/_\("([^\"]|\\.)+"//;s/"%s"//' \
646 { echo
'$(ME): found unmarked diagnostic(s)' 1>&2; \
649 # Like the above, but prohibit a newline at the end of a diagnostic.
650 # This is subject to false positives partly because it naively looks for
651 # `\n"', which may not be the end of the string, and also because it takes
652 # two lines of context (the -A2) after the line with the function name.
653 # FIXME: this rule might benefit from a separate function list, in case
654 # there are functions to which this one applies but that do not get marked
656 sc_prohibit_newline_at_end_of_diagnostic
:
657 @
$(VC_LIST_EXCEPT
) | xargs
$(GREP
) -A2
-nE \
658 '\<$(func_re) *\(' /dev
/null \
660 && { echo
'$(ME): newline at end of message(s)' 1>&2; \
663 # Look for diagnostics that lack a % in the format string, except that we
664 # allow VIR_ERROR to do this, and ignore functions that take a single
665 # string rather than a format argument.
666 sc_prohibit_diagnostic_without_format
:
667 @
{ $(VC_LIST_EXCEPT
) | xargs \
668 $(GREP
) -nE
'\<$(func_re) *\(.*;$$' /dev
/null
; \
669 $(VC_LIST_EXCEPT
) | xargs \
670 $(GREP
) -A2
-nE
'\<$(func_re) *\(.*,$$' /dev
/null
; } \
671 |
$(SED
) -rn
-e
':l; /[,"]$$/ {N;b l;}' \
672 -e
'/(xenapiSessionErrorHandler|vah_(error|warning))/d' \
673 -e
'/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \
674 |
$(GREP
) -vE
'VIR_ERROR' && \
675 { echo
'$(ME): found diagnostic without %' 1>&2; \
678 # The strings "" and "%s" should never be marked for translation.
679 # Files under tests/ and examples/ should not be translated.
680 sc_prohibit_useless_translation
:
681 @prohibit
='_\("(%s)?"\)' \
682 halt
='found useless translation' \
684 @prohibit
='\<N?_ *\(' \
685 in_vc_files
='(tests|examples)/' \
686 halt
='no translations in tests or examples' \
689 # When splitting a diagnostic across lines, ensure that there is a space
690 # or \n on one side of the split.
691 sc_require_whitespace_in_translation
:
692 @
$(VC_LIST_EXCEPT
) | xargs
$(GREP
) -n
-A1
'"$$' /dev
/null \
693 |
$(SED
) -ne
':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \
694 -e
'/_(.*[^\ ]""[^\ ]/p' |
$(GREP
) .
&& \
695 { echo
'$(ME): missing whitespace at line split' 1>&2; \
698 # Enforce recommended preprocessor indentation style.
699 sc_preprocessor_indentation
:
700 @if cppi
--version
>/dev
/null
2>&1; then \
701 $(VC_LIST_EXCEPT
) |
$(GREP
) -E
'\.[ch](\.in)?$$' | xargs cppi
-a
-c \
702 ||
{ echo
'$(ME): incorrect preprocessor indentation' 1>&2; \
705 echo
'$(ME): skipping test $@: cppi not installed' 1>&2; \
708 # Enforce similar spec file indentation style, by running cppi on a
709 # (comment-only) C file that mirrors the same layout as the spec file.
711 @if cppi
--version
>/dev
/null
2>&1; then \
712 for f in
$$($(VC_LIST_EXCEPT
) |
$(GREP
) '\.spec\.in$$'); do \
713 $(SED
) -e
's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \
714 -e
's/%\(else\|endif\|define\)/#\1/' \
715 -e
's/^\( *\)\1\1\1#/#\1/' \
716 -e
's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \
717 | cppi
-a
-c
2>&1 |
$(SED
) "s|standard input|$$f|"; \
718 done |
{ if
$(GREP
) .
>&2; then false
; else :; fi
; } \
719 ||
{ echo
'$(ME): incorrect preprocessor indentation' 1>&2; \
722 echo
'$(ME): skipping test $@: cppi not installed' 1>&2; \
725 # Nested conditionals are easier to understand if we enforce that endifs
726 # can be paired back to the if
727 sc_makefile_conditionals
:
728 @prohibit
='(else|endif)($$| *#)' \
729 in_vc_files
='Makefile\.am' \
730 halt
='match "if FOO" with "endif FOO" in Makefiles' \
733 # Long lines can be harder to diff; too long, and git send-email chokes.
734 # For now, only enforce line length on files where we have intentionally
735 # fixed things and don't want to regress.
736 sc_prohibit_long_lines
:
738 in_vc_files
='\.arg[sv]' \
739 halt
='Wrap long lines in expected output files' \
742 in_vc_files
='Makefile\.am' \
743 halt
='Wrap long lines in Makefiles' \
747 @require
='Copyright .*Red 'Hat
', Inc\.' \
748 containing
='Copyright .*Red 'Hat \
749 halt
='Red Hat copyright is missing Inc.' \
751 @prohibit
='Copyright [^(].*Red 'Hat \
752 halt
='consistently use (C) in Red Hat copyright' \
754 @prohibit
='\<RedHat\>' \
755 halt
='spell Red Hat as two words' \
758 # Prefer the new URL listing over the old street address listing when
759 # calling out where to get a copy of the [L]GPL. Also, while we have
760 # to ship COPYING (GPL) alongside COPYING.LESSER (LGPL), we want any
761 # source file that calls out a top-level file to call out the LGPL
762 # version. Note that our typical copyright boilerplate refers to the
763 # license by name, not by reference to a top-level file.
765 @prohibit
=Boston
,' MA' \
766 halt
='Point to <http://www.gnu.org/licenses/>, not an address' \
768 @require
='COPYING\.LESSER' \
769 containing
='COPYING' \
770 halt
='Refer to COPYING.LESSER for LGPL' \
772 @prohibit
='COPYING\.LIB' \
773 halt
='Refer to COPYING.LESSER for LGPL' \
776 # Some functions/macros produce messages intended solely for developers
777 # and maintainers. Do not mark them for translation.
778 sc_prohibit_gettext_markup
:
779 @prohibit
='\<VIR_(WARN|INFO|DEBUG) *\(_\(' \
780 halt
='do not mark these strings for translation' \
783 # Our code is divided into modular subdirectories for a reason, and
784 # lower-level code must not include higher-level headers.
785 cross_dirs
=$(patsubst $(srcdir)/src
/%.
,%,$(wildcard $(srcdir)/src
/*/.
))
786 cross_dirs_re
=($(subst / ,/|
,$(cross_dirs
)))
787 mid_dirs
=access|admin|conf|cpu|locking|logging|rpc|security
788 sc_prohibit_cross_inclusion
:
789 @for
dir in
$(cross_dirs
); do \
791 util
/) safe
="util";; \
792 access
/ | conf
/) safe
="($$dir|conf|util)";; \
793 cpu
/| network
/| node_device
/| rpc
/| security
/| storage
/) \
794 safe
="($$dir|util|conf|storage)";; \
795 xenapi
/ | xenconfig
/ ) safe
="($$dir|util|conf|xen|cpu)";; \
796 *) safe
="($$dir|$(mid_dirs)|util)";; \
798 in_vc_files
="^src/$$dir" \
799 prohibit
='^# *include .$(cross_dirs_re)' \
800 exclude
="# *include .$$safe" \
801 halt
='unsafe cross-directory include' \
802 $(_sc_search_regexp
) \
805 # When converting an enum to a string, make sure that we track any new
806 # elements added to the enum by using a _LAST marker.
807 sc_require_enum_last_marker
:
808 @
$(VC_LIST_EXCEPT
) | xargs \
809 $(GREP
) -A1
-nE
'^[^#]*VIR_ENUM_IMPL *\(' /dev
/null \
810 |
$(SED
) -ne
'/VIR_ENUM_IMPL.*,$$/N' \
811 -e
'/VIR_ENUM_IMPL[^,]*,[^,]*,[^,]*[^_,][^L,][^A,][^S,][^T,],/p' \
812 -e
'/VIR_ENUM_IMPL[^,]*,[^,]\{0,4\},/p' \
814 { echo
'$(ME): enum impl needs _LAST marker on second line' 1>&2; \
817 # In Python files we don't want to end lines with a semicolon like in C
818 sc_prohibit_semicolon_at_eol_in_python
:
819 @prohibit
='^[^#].*\;$$' \
820 in_vc_files
='\.py$$' \
821 halt
='python does not require to end lines with a semicolon' \
824 # mymain() in test files should use return, not exit, for nicer output
825 sc_prohibit_exit_in_tests
:
826 @prohibit
='\<exit *\(' \
827 in_vc_files
='tests/.*\.c$$' \
828 halt
='use return, not exit(), in tests' \
831 # Don't include "libvirt/*.h" in "" form.
832 sc_prohibit_include_public_headers_quote
:
833 @prohibit
='# *include *"libvirt/.*\.h"' \
834 in_vc_files
='\.[ch]$$' \
835 halt
='Do not include libvirt/*.h in internal source' \
838 # Don't include "libvirt/*.h" in <> form. Except for external tools,
839 # e.g. Python binding, examples and tools subdirectories.
840 sc_prohibit_include_public_headers_brackets
:
841 @prohibit
='# *include *<libvirt/.*\.h>' \
842 in_vc_files
='\.[ch]$$' \
843 halt
='Do not include libvirt/*.h in internal source' \
846 # <config.h> is only needed in .c files; .h files do not need it since
847 # .c files must include config.h before any other .h.
848 sc_prohibit_config_h_in_headers
:
849 @prohibit
='^# *include\>.*config\.h' \
850 in_vc_files
='\.h$$' \
851 halt
='headers should not include <config.h>' \
854 sc_prohibit_unbounded_arrays_in_rpc
:
856 in_vc_files
='\.x$$' \
857 halt
='Arrays in XDR must have a upper limit set for <NNN>' \
861 @prohibit
='\b(secure_)?getenv *\(' \
862 exclude
='exempt from syntax-check' \
863 halt
='Use virGetEnv{Allow,Block}SUID instead of getenv' \
867 @prohibit
='\bato(i|f|l|ll|q) *\(' \
868 halt
='Use virStrToLong* instead of atoi, atol, atof, atoq, atoll' \
871 sc_prohibit_wrong_filename_in_comment
:
872 @
$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[ch]$$' | xargs awk
'BEGIN { \
875 n=match($$0, /[[:space:]][^[:space:]]*[.][ch][[:space:]:]/); \
877 A=substr($$0, RSTART+1, RLENGTH-2); \
878 n=split(FILENAME, arr, "/"); \
880 print "in " FILENAME ": " A " mentioned in comments "; \
888 }' ||
{ echo
'$(ME): The file name in comments must match the' \
889 'actual file name' 1>&2; exit
1; }
891 sc_prohibit_virConnectOpen_in_virsh
:
892 @prohibit
='\bvirConnectOpen[a-zA-Z]* *\(' \
893 in_vc_files
='tools/virsh-.*\.[ch]$$' \
894 halt
='Use vshConnect() in virsh instead of virConnectOpen*' \
897 sc_require_space_before_label
:
898 @prohibit
='^( ?)?[_a-zA-Z0-9]+:$$' \
899 in_vc_files
='\.[ch]$$' \
900 halt
='Top-level labels should be indented by one space' \
903 # Allow for up to three spaces before the label: this is to avoid running
904 # into situations where neither this rule nor require_space_before_label
905 # would apply, eg. a line matching ^[a-zA-Z0-9]+ :$
906 sc_prohibit_space_in_label
:
907 @prohibit
='^ {0,3}[_a-zA-Z0-9]+ +:$$' \
908 in_vc_files
='\.[ch]$$' \
909 halt
='There should be no space between label name and colon' \
912 # Doesn't catch all cases of mismatched braces across if-else, but it helps
913 sc_require_if_else_matching_braces
:
914 @prohibit
='( else( if .*\))? {|} else( if .*\))?$$)' \
915 in_vc_files
='\.[chx]$$' \
916 halt
='if one side of if-else uses {}, both sides must use it' \
919 sc_curly_braces_style
:
920 @if
$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[ch]$$' | xargs
$(GREP
) -nHP \
921 '^\s*(?!([a-zA-Z_]*for_?each[a-zA-Z_]*) ?\()([_a-zA-Z0-9]+( [_a-zA-Z0-9]+)* ?\()?(\*?[_a-zA-Z0-9]+(,? \*?[_a-zA-Z0-9\[\]]+)+|void)\) ?\{' \
923 echo
'$(ME): Non-K&R style used for curly braces around' \
924 'function body' 1>&2; exit
1; \
926 if
$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[ch]$$' | xargs \
927 $(GREP
) -A1
-En
' ((if|for|while|switch) \(|(else|do)\b)[^{]*$$' \
928 /dev
/null |
$(GREP
) '^[^ ]*- *{'; then \
929 echo
'$(ME): Use hanging braces for compound statements' 1>&2; exit
1; \
932 sc_prohibit_windows_special_chars_in_filename
:
933 @
$(VC_LIST_EXCEPT
) |
$(GREP
) '[:*?"<>|]' && \
934 { echo
'$(ME): Windows special chars in filename not allowed' 1>&2; echo exit
1; } ||
:
936 sc_prohibit_mixed_case_abbreviations
:
937 @prohibit
='Pci|Usb|Scsi' \
938 in_vc_files
='\.[ch]$$' \
939 halt
='Use PCI, USB, SCSI, not Pci, Usb, Scsi' \
942 # Require #include <locale.h> in all files that call setlocale()
944 @require
='include.*locale\.h' \
945 containing
='setlocale *(' \
946 halt
='setlocale() requires <locale.h>' \
949 sc_prohibit_empty_first_line
:
950 @
$(VC_LIST_EXCEPT
) | xargs awk
'BEGIN { fail=0; } \
951 FNR == 1 { if ($$0 == "") { print FILENAME ":1:"; fail=1; } } \
952 END { if (fail == 1) { \
953 print "$(ME): Prohibited empty first line" > "/dev/stderr"; \
956 sc_prohibit_paren_brace
:
958 in_vc_files
='\.[chx]$$' \
959 halt
='Put space between closing parenthesis and opening brace' \
962 # C guarantees that static variables are zero initialized, and some compilers
963 # waste space by sticking explicit initializers in .data instead of .bss
964 sc_prohibit_static_zero_init
:
965 @prohibit
='\bstatic\b.*= *(0[^xX0-9]|NULL|false)' \
966 in_vc_files
='\.[chx](\.in)?$$' \
967 halt
='static variables do not need explicit zero initialization'\
970 # FreeBSD exports the "devname" symbol which produces a warning.
972 @prohibit
='\bdevname\b' \
973 exclude
='sc_prohibit_devname' \
974 halt
='avoid using devname as FreeBSD exports the symbol' \
977 sc_prohibit_system_error_with_vir_err
:
978 @prohibit
='\bvirReportSystemError *\(VIR_ERR_' \
979 halt
='do not use virReportSystemError with VIR_ERR_* error codes' \
982 # Rule to prohibit usage of virXXXFree within library, daemon, remote, etc.
983 # functions. There's a corresponding exclude to allow usage within tests,
984 # docs, examples, tools, src/libvirt-*.c, and include/libvirt/libvirt-*.h
985 sc_prohibit_virXXXFree
:
986 @prohibit
='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter|Interface|DomainSnapshot)Free\b' \
987 exclude
='sc_prohibit_virXXXFree' \
988 halt
='avoid using virXXXFree, use virObjectUnref instead' \
991 sc_prohibit_sysconf_pagesize
:
992 @prohibit
='sysconf\(_SC_PAGESIZE' \
993 halt
='use virGetSystemPageSize[KB] instead of sysconf(_SC_PAGESIZE)' \
996 sc_prohibit_virSecurity
:
997 @
$(VC_LIST_EXCEPT
) |
$(GREP
) 'src/qemu/' | \
998 $(GREP
) -v
'src/qemu/qemu_security' | \
999 xargs
$(GREP
) -Pn
'virSecurityManager(?!Ptr)' /dev
/null
&& \
1000 { echo
'$(ME): prefer qemuSecurity wrappers' 1>&2; exit
1; } ||
:
1002 sc_prohibit_pthread_create
:
1003 @prohibit
='\bpthread_create\b' \
1004 exclude
='sc_prohibit_pthread_create' \
1005 halt
='avoid using pthread_create, use virThreadCreate instead' \
1006 $(_sc_search_regexp
)
1008 sc_prohibit_not_streq
:
1009 @prohibit
='! *STRN?EQ *\(.*\)' \
1010 halt
='Use STRNEQ instead of !STREQ and STREQ instead of !STRNEQ' \
1011 $(_sc_search_regexp
)
1013 sc_prohibit_verbose_strcat
:
1014 @prohibit
='strncat\([^,]*,\s+([^,]*),\s+strlen\(\1\)\)' \
1015 in_vc_files
='\.[ch]$$' \
1016 halt
='Use strcat(a, b) instead of strncat(a, b, strlen(b))' \
1017 $(_sc_search_regexp
)
1019 # Ensure that each .c file containing a "main" function also
1020 # calls virGettextInitialize
1022 @require
='virGettextInitialize *\(' \
1023 in_vc_files
='\.c$$' \
1024 containing
='\<main *(' \
1025 halt
='the above files do not call virGettextInitialize' \
1026 $(_sc_search_regexp
)
1028 sc_prohibit_obj_free_apis_in_virsh
:
1029 @prohibit
='\bvir(Domain|DomainSnapshot)Free\b' \
1030 in_vc_files
='virsh.*\.[ch]$$' \
1031 exclude
='sc_prohibit_obj_free_apis_in_virsh' \
1032 halt
='avoid using virDomain(Snapshot)Free in virsh, use virsh-prefixed wrappers instead' \
1033 $(_sc_search_regexp
)
1035 https_sites
= www.libvirt.org
1036 https_sites
+= libvirt.org
1037 https_sites
+= security.libvirt.org
1038 https_sites
+= qemu.org
1039 https_sites
+= www.qemu.org
1040 https_sites
+= wiki.qemu.org
1041 https_sites
+= linux-kvm.org
1042 https_sites
+= www.linux-kvm.org
1044 https_re
= ($(subst $(space
),|
,$(https_sites
)))
1046 sc_prohibit_http_urls
:
1047 @prohibit
='http://$(https_re)' \
1048 exclude
="/schemas/" \
1049 halt
='Links must use https:// protocol' \
1050 $(_sc_search_regexp
)
1053 @prohibit
="(\*|#)\s*(A|a)uthors?:" \
1054 halt
="Author: statements are prohibited in source comments" \
1055 $(_sc_search_regexp
)
1057 # Alignment is usually achieved through spaces (at least two of them)
1058 # or tabs (at least one of them) right before the trailing backslash
1059 sc_prohibit_backslash_alignment
:
1060 @prohibit
='( | )\\$$' \
1061 in_vc_files
='*\.([chx]|am|mk)$$' \
1062 halt
='Do not attempt to right-align backslashes' \
1063 $(_sc_search_regexp
)
1065 # Some syntax rules pertaining to the usage of cleanup macros
1066 # implementing GNU C's cleanup attribute
1068 # Rule to ensure that variables declared using a cleanup macro are
1069 # always initialized.
1070 sc_require_attribute_cleanup_initialization
:
1071 @prohibit
='VIR_AUTO((FREE|PTR|UNREF|CLEAN)\(.+\)|CLOSE|STRINGLIST) *[^=]+;' \
1072 in_vc_files
='\.[chx]$$' \
1073 halt
='variable declared with a cleanup macro must be initialized' \
1074 $(_sc_search_regexp
)
1076 # "class" in headers is not good because by default Vim treats it as a keyword
1077 # Let's prohibit it in source files as well.
1079 @prohibit
=' +_?class *;' \
1080 in_vc_files
='\.[chx]$$' \
1081 halt
='use klass instead of class or _class' \
1082 $(_sc_search_regexp
)
1084 # The dirent "d_type" field is non-portable and even when it
1085 # exists some filesystems will only ever return DT_UNKNOWN.
1086 # This field should only be used by code which is exclusively
1087 # run platforms supporting "d_type" and must expect DT_UNKNOWN.
1088 # We blacklist it to discourage accidental usage which has
1089 # happened many times. Add an exclude rule if it is genuinely
1090 # needed and the above restrictions are acceptable.
1091 sc_prohibit_dirent_d_type
:
1092 @prohibit
='(->|\.)d_type' \
1093 in_vc_files
='\.[chx]$$' \
1094 halt
='do not use the d_type field in "struct dirent"' \
1095 $(_sc_search_regexp
)
1098 # We don't use this feature of maint.mk.
1099 prev_version_file
= /dev
/null
1101 ifneq ($(_gl-Makefile
),)
1102 ifeq (0,$(MAKELEVEL
))
1103 _dry_run_result
:= $(shell \
1105 test -d .git ||
test -f .git ||
{ echo
0; exit
; }; \
1106 $(srcdir)/autogen.sh
--dry-run
>/dev
/null
2>&1; \
1109 _clean_requested
= $(filter %clean,$(MAKECMDGOALS
))
1111 # A return value of 0 means no action is required
1113 # A return value of 1 means a genuine error has occurred while
1114 # performing the dry run, and it should be reported so it can
1116 ifeq (1,$(_dry_run_result
))
1117 $(info INFO
: autogen.sh error
, running again to show details
)
1118 maint.mk Makefile
: _autogen_error
1121 # A return value of 2 means that autogen.sh needs to be executed
1122 # in earnest before building, probably because of gnulib updates.
1123 # We don't run autogen.sh if the clean target has been invoked,
1124 # though, as it would be quite pointless
1125 ifeq (2,$(_dry_run_result
)$(_clean_requested
))
1126 $(info INFO
: running autogen.sh is required
, running it now...
)
1127 $(shell touch
$(srcdir)/AUTHORS
)
1128 maint.mk Makefile
: _autogen
1133 # It is necessary to call autogen any time gnulib changes. Autogen
1134 # reruns configure, then we regenerate all Makefiles at once.
1137 $(srcdir)/autogen.sh
1140 .PHONY
: _autogen_error
1142 $(srcdir)/autogen.sh
--dry-run
1144 ifneq ($(_gl-Makefile
),)
1145 syntax-check
: spacing-check test-wrap-argv \
1146 prohibit-duplicate-header mock-noinline group-qemu-caps \
1148 @if
! cppi
--version
>/dev
/null
2>&1; then \
1149 echo
"*****************************************************" >&2; \
1150 echo
"* cppi not installed, some checks have been skipped *" >&2; \
1151 echo
"*****************************************************" >&2; \
1155 # Don't include duplicate header in the source (either *.c or *.h)
1156 prohibit-duplicate-header
:
1157 $(AM_V_GEN
)$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[chx]$$' | xargs \
1158 $(PERL
) -W
$(top_srcdir
)/build-aux
/prohibit-duplicate-header.pl
1161 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) '\.c$$' | xargs \
1162 $(PERL
) $(top_srcdir
)/build-aux
/check-spacing.pl || \
1163 { echo
'$(ME): incorrect formatting' 1>&2; exit
1; }
1166 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) '\.[ch]$$' | xargs \
1167 $(PERL
) $(top_srcdir
)/build-aux
/mock-noinline.pl
1170 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) '\.[h]$$' | xargs \
1171 $(PERL
) $(top_srcdir
)/build-aux
/header-ifdef.pl
1174 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) -E
'\.(ldargs|args)' | xargs \
1175 $(PERL
) $(top_srcdir
)/tests
/test-wrap-argv.pl
--check
1178 $(AM_V_GEN
)$(PERL
) $(top_srcdir
)/tests
/group-qemu-caps.pl
--check $(top_srcdir
)/
1180 # sc_po_check can fail if generated files are not built first
1182 $(srcdir)/src
/remote
/remote_daemon_dispatch_stubs.h \
1183 $(srcdir)/src
/remote
/remote_daemon_dispatch_qemu_stubs.h \
1184 $(srcdir)/src
/remote
/remote_client_bodies.h \
1185 $(srcdir)/src
/admin
/admin_server_dispatch_stubs.h \
1186 $(srcdir)/src
/admin
/admin_client.h
1187 $(srcdir)/src
/remote
/remote_daemon_dispatch_stubs.h
: $(srcdir)/src
/remote
/remote_protocol.x
1188 $(MAKE
) -C src remote
/remote_daemon_dispatch_stubs.h
1189 $(srcdir)/src
/remote
/remote_daemon_dispatch_qemu_stubs.h
: $(srcdir)/src
/remote
/qemu_protocol.x
1190 $(MAKE
) -C src remote
/remote_daemon_dispatch_qemu_stubs.h
1191 $(srcdir)/src
/remote
/remote_client_bodies.h
: $(srcdir)/src
/remote
/remote_protocol.x
1192 $(MAKE
) -C src remote
/remote_client_bodies.h
1193 $(srcdir)/src
/admin
/admin_server_dispatch_stubs.h
: $(srcdir)/src
/admin
/admin_protocol.x
1194 $(MAKE
) -C src admin
/admin_server_dispatch_stubs.h
1195 $(srcdir)/src
/admin
/admin_client.h
: $(srcdir)/src
/admin
/admin_protocol.x
1196 $(MAKE
) -C src admin
/admin_client.h
1198 # List all syntax-check exemptions:
1199 exclude_file_name_regexp--sc_avoid_strcase
= ^tools
/vsh\.h
$$
1201 _src1
=libvirt-stream|qemu
/qemu_monitor|util
/vir
(command|file|fdstream
)|xen
/xend_internal|rpc
/virnetsocket|lxc
/lxc_controller|locking
/lock_daemon|logging
/log_daemon
1202 _test1
=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock|commandhelper
1203 exclude_file_name_regexp--sc_avoid_write
= \
1204 ^
(src
/($(_src1
))|tools
/virsh-console|tests
/($(_test1
)))\.c
$$
1206 exclude_file_name_regexp--sc_bindtextdomain
= .
*
1208 exclude_file_name_regexp--sc_gettext_init
= ^
(tests|examples
)/
1210 exclude_file_name_regexp--sc_copyright_format
= \
1213 exclude_file_name_regexp--sc_copyright_usage
= \
1214 ^COPYING
(|\.LESSER
)$$
1216 exclude_file_name_regexp--sc_flags_usage
= \
1217 ^
(cfg\.mk|docs
/|src
/util
/virnetdevtap\.c
$$|tests
/((vir
(cgroup|pci|
test|usb
)|nss|qemuxml2argv|qemusecurity
)mock|virfilewrapper
)\.c
$$)
1219 exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics
= \
1220 ^
(src
/rpc
/gendispatch\.pl
$$|tests
/)
1222 exclude_file_name_regexp--sc_po_check
= ^
(docs
/|src
/rpc
/gendispatch\.pl
$$)
1224 exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY
= \
1225 ^
(cfg\.mk|
include/libvirt
/virterror\.h|src
/remote
/remote_daemon_dispatch\.c|src
/util
/virerror\.c|docs
/internals
/oomtesting\.html\.in
)$$
1227 exclude_file_name_regexp--sc_prohibit_PATH_MAX
= \
1230 exclude_file_name_regexp--sc_prohibit_access_xok
= \
1231 ^
(cfg\.mk|src
/util
/virutil\.c
)$$
1233 exclude_file_name_regexp--sc_prohibit_asprintf
= \
1234 ^
(cfg\.mk|bootstrap.conf
$$|examples
/|src
/util
/virstring\.
[ch
]$$|tests
/vircgroupmock\.c
$$)
1236 exclude_file_name_regexp--sc_prohibit_strdup
= \
1237 ^
(docs
/|examples
/|src
/util
/virstring\.c|tests
/vir
(netserverclient|cgroup
)mock.c|tests
/commandhelper\.c
$$)
1239 exclude_file_name_regexp--sc_prohibit_close
= \
1240 (\.p
[yl
]$$|\.spec\.in
$$|^docs
/|^
(src
/util
/virfile\.c|src
/libvirt-stream\.c|tests
/(vir.
+mock\.c|commandhelper\.c|qemusecuritymock\.c
))$$)
1242 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF
= \
1243 (^tests
/(virhostcpu|virpcitest
)data
/|docs
/js
/.
*\.js|docs
/fonts
/.
*\.woff|\.diff|tests
/virconfdata
/no-newline\.conf
$$)
1245 _src2
=src
/(util
/vircommand|libvirt|lxc
/lxc_controller|locking
/lock_daemon|logging
/log_daemon|remote
/remote_daemon
)
1246 exclude_file_name_regexp--sc_prohibit_fork_wrappers
= \
1247 (^
($(_src2
)|tests
/testutils
)\.c
$$)
1249 exclude_file_name_regexp--sc_prohibit_gethostname
= ^src
/util
/vir
(util|log
)\.c
$$
1251 exclude_file_name_regexp--sc_prohibit_internal_functions
= \
1252 ^src
/(util
/(viralloc|virutil|virfile
)\.
[hc
]|esx
/esx_vi\.c
)$$
1254 exclude_file_name_regexp--sc_prohibit_raw_virclassnew
= \
1255 ^src
/util
/virobject\.
[hc
]$$
1257 exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic
= \
1258 ^src
/rpc
/gendispatch\.pl
$$
1260 exclude_file_name_regexp--sc_prohibit_nonreentrant
= \
1261 ^
((po|tests|examples
)/|docs
/.
*(py|js|html\.in
)|run.in
$$|tools
/wireshark
/util
/genxdrstub\.pl
$$)
1263 exclude_file_name_regexp--sc_prohibit_select
= \
1266 exclude_file_name_regexp--sc_prohibit_canonicalize_file_name
= \
1267 ^
(cfg\.mk|tests
/virfilemock\.c
)$$
1269 exclude_file_name_regexp--sc_prohibit_raw_allocation
= \
1270 ^
(docs
/hacking\.html\.in|src
/util
/viralloc\.
[ch
]|examples
/.
*|tests
/(securityselinuxhelper|
(vircgroup|nss
)mock|commandhelper
)\.c|tools
/wireshark
/src
/packet-libvirt\.c
)$$
1272 exclude_file_name_regexp--sc_prohibit_readlink
= \
1273 ^src
/(util
/virutil|lxc
/lxc_container
)\.c
$$
1275 exclude_file_name_regexp--sc_prohibit_setuid
= ^src
/util
/virutil\.c
$$
1277 exclude_file_name_regexp--sc_prohibit_sprintf
= \
1278 ^
(cfg\.mk|docs
/hacking\.html\.in|.
*\.stp|.
*\.pl
)$$
1280 exclude_file_name_regexp--sc_prohibit_strncpy
= ^src
/util
/virstring\.c
$$
1282 exclude_file_name_regexp--sc_prohibit_strtol
= ^examples
/.
*$$
1284 exclude_file_name_regexp--sc_prohibit_xmlGetProp
= ^src
/util
/virxml\.c
$$
1286 exclude_file_name_regexp--sc_prohibit_xmlURI
= ^src
/util
/viruri\.c
$$
1288 exclude_file_name_regexp--sc_prohibit_return_as_function
= \.py
$$
1290 exclude_file_name_regexp--sc_require_config_h
= \
1291 ^
(examples
/|tools
/virsh-edit\.c
$$|tests
/virmockstathelpers.c
)
1293 exclude_file_name_regexp--sc_require_config_h_first
= \
1294 ^
(examples
/|tools
/virsh-edit\.c
$$|tests
/virmockstathelpers.c
)
1296 exclude_file_name_regexp--sc_trailing_blank
= \
1297 /sysinfodata
/.
*\.data|
/virhostcpudata
/.
*\.cpuinfo|^gnulib
/local
/.
*/.
*diff
$$
1299 exclude_file_name_regexp--sc_unmarked_diagnostics
= \
1300 ^
(docs
/apibuild.py|tests
/virt-aa-helper-test|docs
/js
/.
*\.js
)$$
1302 exclude_file_name_regexp--sc_size_of_brackets
= cfg.mk
1304 exclude_file_name_regexp--sc_correct_id_types
= \
1305 (^src
/locking
/lock_protocol.x
$$)
1307 exclude_file_name_regexp--sc_m4_quote_check
= m4
/virt-lib.m4
1309 exclude_file_name_regexp--sc_prohibit_include_public_headers_quote
= \
1310 ^
(src
/internal\.h
$$|tools
/wireshark
/src
/packet-libvirt.c
$$)
1312 exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets
= \
1313 ^
(tools
/|examples
/|
include/libvirt
/(virterror|libvirt
(-(admin|qemu|lxc
))?
)\.h
$$)
1315 exclude_file_name_regexp--sc_prohibit_int_ijk
= \
1316 ^
(src
/remote_protocol-structs|src
/remote
/remote_protocol\.x|cfg\.mk|
include/libvirt
/libvirt.
+|src
/admin_protocol-structs|src
/admin
/admin_protocol\.x
)$$
1318 exclude_file_name_regexp--sc_prohibit_unsigned_pid
= \
1319 ^
(include/libvirt
/.
*\.h|src
/(qemu
/qemu_driver\.c|driver-hypervisor\.h|libvirt
(-[a-z
]*)?\.c|.
*\.x|util
/vir
(polkit|systemd
)\.c
)|tests
/virpolkittest\.c|tools
/virsh-domain\.c
)$$
1321 exclude_file_name_regexp--sc_prohibit_getenv
= \
1324 exclude_file_name_regexp--sc_avoid_attribute_unused_in_header
= \
1325 ^
(src
/util
/virlog\.h|src
/network
/bridge_driver\.h
)$$
1327 exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations
= \
1328 ^src
/(vbox
/vbox_CAPI.
*.h|esx
/esx_vi.
(c|h
)|esx
/esx_storage_backend_iscsi.c
)$$
1330 exclude_file_name_regexp--sc_prohibit_empty_first_line
= \
1331 ^
(README|src
/esx
/README|tests
/(vmwarever|virhostcpu
)data
/.
*)$$
1333 exclude_file_name_regexp--sc_prohibit_useless_translation
= \
1334 ^tests
/virpolkittest.c
1336 exclude_file_name_regexp--sc_prohibit_devname
= \
1337 ^
(tools
/virsh.pod|cfg.mk|docs
/.
*)$$
1339 exclude_file_name_regexp--sc_prohibit_virXXXFree
= \
1340 ^
(docs
/|tests
/|examples
/|tools
/|cfg.mk|src
/test/test_driver.c|src
/libvirt_public.syms|
include/libvirt
/libvirt-
(domain|network|nodedev|storage|stream|secret|nwfilter|interface|domain-snapshot
).h|src
/libvirt-
(domain|qemu|network|nodedev|storage|stream|secret|nwfilter|interface|domain-snapshot
).c
$$)
1342 exclude_file_name_regexp--sc_prohibit_sysconf_pagesize
= \
1343 ^
(cfg\.mk|src
/util
/virutil\.c
)$$
1345 exclude_file_name_regexp--sc_prohibit_pthread_create
= \
1346 ^
(cfg\.mk|src
/util
/virthread\.c|tests
/.
*)$$
1348 exclude_file_name_regexp--sc_prohibit_always-defined_macros
= \
1349 ^tests
/virtestmock.c
$$
1351 exclude_file_name_regexp--sc_prohibit_readdir
= \
1352 ^tests
/(.
*mock|virfilewrapper
)\.c
$$
1354 exclude_file_name_regexp--sc_prohibit_cross_inclusion
= \
1355 ^
(src
/util
/virclosecallbacks\.h|src
/util
/virhostdev\.h
)$$
1357 exclude_file_name_regexp--sc_prohibit_dirent_d_type
= \
1358 ^
(src
/util
/vircgroup.c
)$