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_gnu_make_extensions \
63 sc_prohibit_hash_without_use \
64 sc_prohibit_jm_in_m4 \
65 sc_prohibit_quote_without_use \
66 sc_prohibit_quotearg_without_use \
67 sc_prohibit_stat_st_blocks \
68 sc_prohibit_undesirable_word_seq \
75 sc_two_space_separator_in_usage \
76 sc_error_message_uppercase \
78 sc_require_test_exit_idiom \
82 # Most developers don't run 'make distcheck'. We want the official
83 # dist to be secure, but don't want to penalize other developers
84 # using a distro that has not yet picked up the automake fix.
85 # FIXME remove this ifeq (making the syntax check unconditional)
86 # once fixed automake (1.11.6 or 1.12.2+) is more common.
87 ifeq ($(filter dist%, $(MAKECMDGOALS
)), )
88 local-checks-to-skip
+= sc_vulnerable_makefile_CVE-2012-3386
90 distdir
: sc_vulnerable_makefile_CVE-2012-3386.z
93 # Files that should never cause syntax check failures.
94 VC_LIST_ALWAYS_EXCLUDE_REGEX
= \
95 (^
(docs
/(news
(-[0-9]*)?\.html\.in|.
*\.patch
))|\.
(po|fig|gif|ico|png
))$$
97 # Functions like free() that are no-ops on NULL arguments.
98 useless_free_options
= \
99 --name
=VBOX_UTF16_FREE \
100 --name
=VBOX_UTF8_FREE \
101 --name
=VBOX_COM_UNALLOC_MEM \
103 --name
=qemuCapsFree \
104 --name
=qemuMigrationCookieFree \
105 --name
=qemuMigrationCookieGraphicsFree \
107 --name
=usbFreeDevice \
108 --name
=virBandwidthDefFree \
109 --name
=virBitmapFree \
110 --name
=virCPUDefFree \
111 --name
=virCapabilitiesFree \
112 --name
=virCapabilitiesFreeGuest \
113 --name
=virCapabilitiesFreeGuestDomain \
114 --name
=virCapabilitiesFreeGuestFeature \
115 --name
=virCapabilitiesFreeGuestMachine \
116 --name
=virCapabilitiesFreeHostNUMACell \
117 --name
=virCapabilitiesFreeMachines \
118 --name
=virCgroupFree \
119 --name
=virCommandFree \
120 --name
=virConfFreeList \
121 --name
=virConfFreeValue \
122 --name
=virDomainActualNetDefFree \
123 --name
=virDomainChrDefFree \
124 --name
=virDomainControllerDefFree \
125 --name
=virDomainDefFree \
126 --name
=virDomainDeviceDefFree \
127 --name
=virDomainDiskDefFree \
128 --name
=virDomainEventCallbackListFree \
129 --name
=virObjectEventQueueFree \
130 --name
=virDomainFSDefFree \
131 --name
=virDomainGraphicsDefFree \
132 --name
=virDomainHostdevDefFree \
133 --name
=virDomainInputDefFree \
134 --name
=virDomainNetDefFree \
135 --name
=virDomainObjFree \
136 --name
=virDomainSmartcardDefFree \
137 --name
=virDomainSnapshotObjFree \
138 --name
=virDomainSoundDefFree \
139 --name
=virDomainVideoDefFree \
140 --name
=virDomainWatchdogDefFree \
141 --name
=virFileDirectFdFree \
143 --name
=virInterfaceDefFree \
144 --name
=virInterfaceIpDefFree \
145 --name
=virInterfaceObjFree \
146 --name
=virInterfaceProtocolDefFree \
147 --name
=virJSONValueFree \
148 --name
=virLastErrFreeData \
149 --name
=virNetMessageFree \
150 --name
=virNWFilterDefFree \
151 --name
=virNWFilterEntryFree \
152 --name
=virNWFilterHashTableFree \
153 --name
=virNWFilterIPAddrLearnReqFree \
154 --name
=virNWFilterIncludeDefFree \
155 --name
=virNWFilterObjFree \
156 --name
=virNWFilterRuleDefFree \
157 --name
=virNWFilterRuleInstFree \
158 --name
=virNetworkDefFree \
159 --name
=virNodeDeviceDefFree \
160 --name
=virNodeDeviceObjFree \
161 --name
=virObjectUnref \
162 --name
=virObjectFreeCallback \
163 --name
=virPCIDeviceFree \
164 --name
=virSecretDefFree \
165 --name
=virStorageEncryptionFree \
166 --name
=virStorageEncryptionSecretFree \
167 --name
=virStorageFileFreeMetadata \
168 --name
=virStoragePoolDefFree \
169 --name
=virStoragePoolObjFree \
170 --name
=virStoragePoolSourceFree \
171 --name
=virStorageVolDefFree \
172 --name
=virThreadPoolFree \
173 --name
=xmlBufferFree \
177 --name
=xmlXPathFreeContext \
178 --name
=xmlXPathFreeObject
180 # The following template was generated by this command:
181 # make ID && aid free|grep '^vi'|sed 's/ .*//;s/^/# /'
182 # N virBufferFreeAndReset
184 # y virCapabilitiesFree
185 # y virCapabilitiesFreeGuest
186 # y virCapabilitiesFreeGuestDomain
187 # y virCapabilitiesFreeGuestFeature
188 # y virCapabilitiesFreeGuestMachine
189 # y virCapabilitiesFreeHostNUMACell
190 # y virCapabilitiesFreeMachines
191 # N virCapabilitiesFreeNUMAInfo FIXME
193 # N virConfFree (diagnoses the "error")
196 # y virDomainChrDefFree
197 # y virDomainControllerDefFree
199 # y virDomainDeviceDefFree
200 # y virDomainDiskDefFree
201 # y virDomainEventCallbackListFree
202 # y virDomainEventQueueFree
203 # y virDomainFSDefFree
205 # n virDomainFreeName (can't fix -- returns int)
206 # y virDomainGraphicsDefFree
207 # y virDomainHostdevDefFree
208 # y virDomainInputDefFree
209 # y virDomainNetDefFree
211 # n virDomainSnapshotFree (returns int)
212 # n virDomainSnapshotFreeName (returns int)
213 # y virDomainSnapshotObjFree
214 # y virDomainSoundDefFree
215 # y virDomainVideoDefFree
216 # y virDomainWatchdogDefFree
217 # n virDrvNodeGetCellsFreeMemory (returns int)
218 # n virDrvNodeGetFreeMemory (returns long long)
219 # n virFree - dereferences param
221 # n virHashFree (takes 2 args)
222 # y virInterfaceDefFree
223 # n virInterfaceFree (returns int)
224 # n virInterfaceFreeName
225 # y virInterfaceIpDefFree
226 # y virInterfaceObjFree
227 # n virInterfaceObjListFree
228 # y virInterfaceProtocolDefFree
230 # y virLastErrFreeData
231 # y virNWFilterDefFree
232 # y virNWFilterEntryFree
233 # n virNWFilterFree (returns int)
234 # y virNWFilterHashTableFree
235 # y virNWFilterIPAddrLearnReqFree
236 # y virNWFilterIncludeDefFree
237 # n virNWFilterFreeName (returns int)
238 # y virNWFilterObjFree
239 # n virNWFilterObjListFree FIXME
240 # y virNWFilterRuleDefFree
241 # n virNWFilterRuleFreeInstanceData (typedef)
242 # y virNWFilterRuleInstFree
243 # y virNetworkDefFree
244 # n virNetworkFree (returns int)
245 # n virNetworkFreeName (returns int)
246 # n virNodeDevCapsDefFree FIXME
247 # y virNodeDeviceDefFree
248 # n virNodeDeviceFree (returns int)
249 # y virNodeDeviceObjFree
250 # n virNodeDeviceObjListFree FIXME
251 # n virNodeGetCellsFreeMemory (returns int)
252 # n virNodeGetFreeMemory (returns non-void)
254 # n virSecretFree (returns non-void)
255 # n virSecretFreeName (2 args)
256 # n virSecurityLabelDefFree FIXME
257 # n virStorageBackendDiskMakeFreeExtent (returns non-void)
258 # y virStorageEncryptionFree
259 # y virStorageEncryptionSecretFree
260 # n virStorageFreeType (enum)
261 # y virStoragePoolDefFree
262 # n virStoragePoolFree (returns non-void)
263 # n virStoragePoolFreeName (returns non-void)
264 # y virStoragePoolObjFree
265 # n virStoragePoolObjListFree FIXME
266 # y virStoragePoolSourceFree
267 # y virStorageVolDefFree
268 # n virStorageVolFree (returns non-void)
269 # n virStorageVolFreeName (returns non-void)
272 # Avoid uses of write(2). Either switch to streams (fwrite), or use
273 # the safewrite wrapper.
275 @prohibit
='\<write *\(' \
276 in_vc_files
='\.c$$' \
277 halt
='consider using safewrite instead of write' \
280 # In debug statements, print flags as bitmask and mode_t as octal.
282 @prohibit
='\<mode=%[0-9.]*[diuxo]' \
283 halt
='use \"0%o\" to debug mode_t values' \
285 @prohibit
='[Ff]lags=%[0-9.]*l*[dioux]' \
286 halt
='use \"0x%x\" to debug flag values' \
289 # Prefer 'unsigned int flags', along with checks for unknown flags.
290 # For historical reasons, we are stuck with 'unsigned long flags' in
291 # migration, so check for those known 4 instances and no more in public
292 # API. Also check that no flags are marked unused, and 'unsigned' should
293 # appear before any declaration of a flags variable (achieved by
294 # prohibiting the word prior to the type from ending in anything other
295 # than d). The existence of long long, and of documentation about
296 # flags, makes the regex in the third test slightly harder.
298 @
test "$$(cat $(srcdir)/include/libvirt/libvirt-domain.h \
299 $(srcdir)/include/libvirt/virterror.h \
300 $(srcdir)/include/libvirt/libvirt-qemu.h \
301 $(srcdir)/include/libvirt/libvirt-lxc.h \
302 $(srcdir)/include/libvirt/libvirt-admin.h \
303 | $(GREP) -c '\(long\|unsigned\) flags')" != 4 && \
304 { echo
'$(ME): new API should use "unsigned int flags"' 1>&2; \
306 @prohibit
=' flags ATTRIBUTE_UNUSED' \
307 exclude
='virSecurityDomainImageLabelFlags' \
308 halt
='flags should be checked with virCheckFlags' \
310 @prohibit
='^[^@]*([^d] (int|long long)|[^dg] long) flags[;,)]' \
311 halt
='flags should be unsigned' \
314 # Avoid functions that should only be called via macro counterparts.
315 sc_prohibit_internal_functions
:
316 @prohibit
='vir(Free|AllocN?|ReallocN|(Insert|Delete)ElementsN|File(Close|Fclose|Fdopen)) *\(' \
317 halt
='use VIR_ macros instead of internal functions' \
320 sc_prohibit_raw_virclassnew
:
321 @prohibit
='virClassNew *\(' \
322 halt
='use VIR_CLASS_NEW instead of virClassNew' \
325 # Avoid raw malloc and free, except in documentation comments.
326 sc_prohibit_raw_allocation
:
327 @prohibit
='^.[^*].*\<((m|c|re)alloc|free) *\([^)]' \
328 halt
='use VIR_ macros from viralloc.h instead of malloc/free' \
331 # Avoid functions that can lead to double-close bugs.
333 @prohibit
='([^>.]|^)\<[fp]?close *\(' \
334 halt
='use VIR_{FORCE_}[F]CLOSE instead of [f]close' \
336 @prohibit
='\<fdopen *\(' \
337 halt
='use VIR_FDOPEN instead of fdopen' \
340 # Prefer virCommand for all child processes.
341 sc_prohibit_fork_wrappers
:
342 @prohibit
='= *\<(fork|popen|system) *\(' \
343 halt
='use virCommand for child processes' \
346 # Prefer mkostemp with O_CLOEXEC.
348 @prohibit
='[^"]\<mkstemps? *\(' \
349 halt
='use mkostemp with O_CLOEXEC instead of mkstemp' \
352 # access with X_OK accepts directories, but we can't exec() those.
353 # access with F_OK or R_OK is okay, though.
354 sc_prohibit_access_xok
:
355 @prohibit
='access(at)? *\(.*X_OK' \
356 halt
='use virFileIsExecutable instead of access(,X_OK)' \
359 # Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
360 # Use STREQLEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
361 snp_
= strncmp
*\
(.
+\
)
363 @prohibit
='! *strncmp *\(|\<$(snp_) *[!=]=|[!=]= *$(snp_)' \
364 exclude
=':# *define STR(N?EQLEN|PREFIX)\(' \
365 halt
='use STREQLEN or STRPREFIX instead of strncmp' \
368 # strtol and friends are too easy to misuse
370 @prohibit
='\bstrto(u?ll?|[ui]max) *\(' \
371 exclude
='exempt from syntax-check' \
372 halt
='use virStrToLong_*, not strtol variants' \
374 @prohibit
='\bstrto[df] *\(' \
375 exclude
='exempt from syntax-check' \
376 halt
='use virStrToDouble, not strtod variants' \
379 # Use virAsprintf rather than as'printf since *strp is undefined on error.
380 # But for plain %s, virAsprintf is overkill compared to strdup.
381 sc_prohibit_asprintf
:
382 @prohibit
='\<v?a[s]printf\>' \
383 halt
='use virAsprintf, not asprintf' \
385 @prohibit
='virAsprintf.*, *"%s",' \
386 halt
='use VIR_STRDUP instead of virAsprintf with "%s"' \
390 @prohibit
='\<strn?dup\> *\(' \
391 halt
='use VIR_STRDUP, not strdup' \
394 # Prefer virSetUIDGID.
396 @prohibit
='\<set(re)?[ug]id\> *\(' \
397 halt
='use virSetUIDGID, not raw set*id' \
400 # Don't compare *id_t against raw -1.
401 sc_prohibit_risky_id_promotion
:
402 @prohibit
='\b(user|group|[ug]id) *[=!]= *-' \
403 halt
='cast -1 to ([ug]id_t) before comparing against id' \
406 # Use snprintf rather than s'printf, even if buffer is provably large enough,
407 # since gnulib has more guarantees for snprintf portability
409 @prohibit
='\<[s]printf\>' \
410 halt
='use snprintf, not sprintf' \
413 sc_prohibit_readlink
:
414 @prohibit
='\<readlink *\(' \
415 halt
='use virFileResolveLink, not readlink' \
418 sc_prohibit_gethostname
:
419 @prohibit
='gethostname *\(' \
420 halt
='use virGetHostname, not gethostname' \
424 @prohibit
='\b(read|close|open)dir *\(' \
425 exclude
='exempt from syntax-check' \
426 halt
='use virDirOpen, virDirRead and VIR_DIR_CLOSE' \
429 sc_prohibit_gettext_noop
:
430 @prohibit
='gettext_noop *\(' \
431 halt
='use N_, not gettext_noop' \
434 sc_prohibit_VIR_ERR_NO_MEMORY
:
435 @prohibit
='\<VIR_ERR_NO_MEMORY\>' \
436 halt
='use virReportOOMError, not VIR_ERR_NO_MEMORY' \
439 sc_prohibit_PATH_MAX
:
440 @prohibit
='\<PATH_MAX\>' \
441 halt
='dynamically allocate paths, do not use PATH_MAX' \
444 include $(srcdir)/Makefile.nonreentrant
445 sc_prohibit_nonreentrant
:
446 @prohibit
="\\<(${NON_REENTRANT_RE}) *\\(" \
447 halt
="use re-entrant functions (usually ending with _r)" \
451 @prohibit
='\<select *\(' \
452 halt
='use poll(), not select()' \
455 # Prohibit the inclusion of <ctype.h>.
457 @prohibit
='^# *include *<ctype\.h>' \
458 halt
='use c-ctype.h instead of ctype.h' \
461 # We have our own wrapper for mocking purposes
462 sc_prohibit_canonicalize_file_name
:
463 @prohibit
='\<canonicalize_file_name\(' \
464 exclude
='exempt from syntax-check' \
465 halt
='use virFileCanonicalizePath() instead of canonicalize_file_name()' \
468 # Insist on correct types for [pug]id.
470 @prohibit
='\<(int|long) *[pug]id\>' \
471 exclude
='exempt from syntax-check' \
472 halt
='use pid_t for pid, uid_t for uid, gid_t for gid' \
475 # "const fooPtr a" is the same as "foo * const a", even though it is
476 # usually desired to have "foo const *a". It's easier to just prevent
477 # the confusing mix of typedef vs. const placement.
478 # Also requires that all 'fooPtr' typedefs are actually pointers.
479 sc_forbid_const_pointer_typedef
:
480 @prohibit
='(^|[^"])const \w*Ptr' \
481 halt
='"const fooPtr var" does not declare what you meant' \
483 @prohibit
='typedef [^(]+ [^*]\w*Ptr\b' \
484 halt
='use correct style and type for Ptr typedefs' \
487 # Forbid sizeof foo or sizeof (foo), require sizeof(foo)
489 @prohibit
='sizeof\s' \
490 halt
='use sizeof(foo), not sizeof (foo) or sizeof foo' \
493 # Ensure that no C source file, docs, or rng schema uses TABs for
494 # indentation. Also match *.h.in files, to get libvirt.h.in. Exclude
495 # files in gnulib, since they're imported.
496 space_indent_files
=(\.
(aug
(\.in
)?|rng|s?
[ch
](\.in
)?|html.in|py|pl|syms
)|
(daemon|tools
)/.
*\.in
)
497 sc_TAB_in_indentation
:
499 in_vc_files
='$(space_indent_files)$$' \
500 halt
='indent with space, not TAB, in C, sh, html, py, syms and RNG schemas' \
503 ctype_re
= isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
504 |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
506 sc_avoid_ctype_macros
:
507 @prohibit
='\b($(ctype_re)) *\(' \
508 in_vc_files
='\.[ch]$$' \
509 halt
='use c-ctype.h instead of ctype macros' \
513 @prohibit
='\bstrn?case(cmp|str) *\(' \
514 halt
='use c-strcase.h instead of raw strcase functions' \
517 sc_prohibit_virBufferAdd_with_string_literal
:
518 @prohibit
='\<virBufferAdd *\([^,]+, *"[^"]' \
519 halt
='use virBufferAddLit, not virBufferAdd, with a string literal' \
522 sc_prohibit_virBufferAsprintf_with_string_literal
:
523 @prohibit
='\<virBufferAsprintf *\([^,]+, *"([^%"\]|\\.|%%)*"\)' \
524 halt
='use virBufferAddLit, not virBufferAsprintf, with a string literal' \
527 sc_forbid_manual_xml_indent
:
528 @prohibit
='virBuffer.*" +<' \
529 halt
='use virBufferAdjustIndent instead of spaces when indenting xml' \
532 # dirname and basename from <libgen.h> are not required to be thread-safe
534 @prohibit
='( (base|dir)name *\(|include .libgen\.h)' \
535 halt
='use functions from gnulib "dirname.h", not <libgen.h>' \
538 # raw xmlGetProp requires some nasty casts
539 sc_prohibit_xmlGetProp
:
540 @prohibit
='\<xmlGetProp *\(' \
541 halt
='use virXMLPropString, not xmlGetProp' \
544 # xml(ParseURI|SaveUri) doesn't handle IPv6 URIs well
546 @prohibit
='\<xml(ParseURI|SaveUri) *\(' \
547 halt
='use virURI(Parse|Format), not xml(ParseURI|SaveUri)' \
550 # we don't want old old-style return with parentheses around argument
551 sc_prohibit_return_as_function
:
552 @prohibit
='\<return *\(([^()]*(\([^()]*\)[^()]*)*)\) *;' \
553 halt
='avoid extra () with return statements' \
556 # ATTRIBUTE_UNUSED should only be applied in implementations, not
557 # header declarations
558 sc_avoid_attribute_unused_in_header
:
559 @prohibit
='^[^#]*ATTRIBUTE_UNUSED([^:]|$$)' \
560 in_vc_files
='\.h$$' \
561 halt
='use ATTRIBUTE_UNUSED in .c rather than .h files' \
564 sc_prohibit_int_index
:
565 @prohibit
='\<(int|unsigned)\s*\*?index\>(\s|,|;)' \
566 halt
='use different name than 'index
' for declaration' \
570 @prohibit
='\<(int|unsigned) ([^(=]* )*(i|j|k)\>(\s|,|;)' \
571 exclude
='exempt from syntax-check' \
572 halt
='use size_t, not int/unsigned int for loop vars i, j, k' \
575 sc_prohibit_loop_iijjkk
:
576 @prohibit
='\<(int|unsigned) ([^=]+ )*(ii|jj|kk)\>(\s|,|;)' \
577 halt
='use i, j, k for loop iterators, not ii, jj, kk' \
580 # RHEL 5 gcc can't grok "for (int i..."
581 sc_prohibit_loop_var_decl
:
582 @prohibit
='\<for *\(\w+[ *]+\w+' \
583 in_vc_files
='\.[ch]$$' \
584 halt
='declare loop iterators outside the for statement' \
587 # Use 'bool', not 'int', when assigning true or false
588 sc_prohibit_int_assign_bool
:
589 @prohibit
='\<int\>.*= *(true|false)' \
590 halt
='use bool type for boolean values' \
593 sc_prohibit_unsigned_pid
:
594 @prohibit
='\<unsigned\> [^,=;(]+pid' \
595 halt
='use signed type for pid values' \
598 # Many of the function names below came from this filter:
599 # git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
600 # |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \
601 # |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)$'
604 msg_gen_function
+= VIR_ERROR
605 msg_gen_function
+= lxcError
606 msg_gen_function
+= regerror
607 msg_gen_function
+= vah_error
608 msg_gen_function
+= vah_warning
609 msg_gen_function
+= virGenericReportError
610 msg_gen_function
+= virRaiseError
611 msg_gen_function
+= virReportError
612 msg_gen_function
+= virReportErrorHelper
613 msg_gen_function
+= virReportSystemError
614 msg_gen_function
+= xenapiSessionErrorHandler
615 msg_gen_function
+= virLastErrorPrefixMessage
617 # Uncomment the following and run "make syntax-check" to see diagnostics
618 # that are not yet marked for translation, but that need to be rewritten
619 # so that they are translatable.
620 # msg_gen_function += fprintf
621 # msg_gen_function += testError
622 # msg_gen_function += vshPrint
623 # msg_gen_function += vshError
627 func_re
= ($(subst $(space
),|
,$(msg_gen_function
)))
629 # Look for diagnostics that aren't marked for translation.
630 # This won't find any for which error's format string is on a separate line.
631 # The sed filters eliminate false-positives like these:
633 # "%s", _("no storage vol w..."
634 sc_libvirt_unmarked_diagnostics
:
635 @prohibit
='\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' \
637 halt
='found unmarked diagnostic(s)' \
639 @
{ $(VC_LIST_EXCEPT
) | xargs \
640 $(GREP
) -nE
'\<$(func_re) *\(.*;$$' /dev
/null
; \
641 $(VC_LIST_EXCEPT
) | xargs \
642 $(GREP
) -A1
-nE
'\<$(func_re) *\(.*,$$' /dev
/null
; } \
643 |
$(SED
) -E
's/_\("([^\"]|\\.)+"//;s/"%s"//' \
645 { echo
'$(ME): found unmarked diagnostic(s)' 1>&2; \
648 # Like the above, but prohibit a newline at the end of a diagnostic.
649 # This is subject to false positives partly because it naively looks for
650 # `\n"', which may not be the end of the string, and also because it takes
651 # two lines of context (the -A2) after the line with the function name.
652 # FIXME: this rule might benefit from a separate function list, in case
653 # there are functions to which this one applies but that do not get marked
655 sc_prohibit_newline_at_end_of_diagnostic
:
656 @
$(VC_LIST_EXCEPT
) | xargs
$(GREP
) -A2
-nE \
657 '\<$(func_re) *\(' /dev
/null \
659 && { echo
'$(ME): newline at end of message(s)' 1>&2; \
662 # Look for diagnostics that lack a % in the format string, except that we
663 # allow VIR_ERROR to do this, and ignore functions that take a single
664 # string rather than a format argument.
665 sc_prohibit_diagnostic_without_format
:
666 @
{ $(VC_LIST_EXCEPT
) | xargs \
667 $(GREP
) -nE
'\<$(func_re) *\(.*;$$' /dev
/null
; \
668 $(VC_LIST_EXCEPT
) | xargs \
669 $(GREP
) -A2
-nE
'\<$(func_re) *\(.*,$$' /dev
/null
; } \
670 |
$(SED
) -rn
-e
':l; /[,"]$$/ {N;b l;}' \
671 -e
'/(xenapiSessionErrorHandler|vah_(error|warning))/d' \
672 -e
'/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \
673 |
$(GREP
) -vE
'VIR_ERROR' && \
674 { echo
'$(ME): found diagnostic without %' 1>&2; \
677 # The strings "" and "%s" should never be marked for translation.
678 # Files under tests/ and examples/ should not be translated.
679 sc_prohibit_useless_translation
:
680 @prohibit
='_\("(%s)?"\)' \
681 halt
='found useless translation' \
683 @prohibit
='\<N?_ *\(' \
684 in_vc_files
='(tests|examples)/' \
685 halt
='no translations in tests or examples' \
688 # When splitting a diagnostic across lines, ensure that there is a space
689 # or \n on one side of the split.
690 sc_require_whitespace_in_translation
:
691 @
$(VC_LIST_EXCEPT
) | xargs
$(GREP
) -n
-A1
'"$$' /dev
/null \
692 |
$(SED
) -ne
':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \
693 -e
'/_(.*[^\ ]""[^\ ]/p' |
$(GREP
) .
&& \
694 { echo
'$(ME): missing whitespace at line split' 1>&2; \
697 # Enforce recommended preprocessor indentation style.
698 sc_preprocessor_indentation
:
699 @if cppi
--version
>/dev
/null
2>&1; then \
700 $(VC_LIST_EXCEPT
) |
$(GREP
) -E
'\.[ch](\.in)?$$' | xargs cppi
-a
-c \
701 ||
{ echo
'$(ME): incorrect preprocessor indentation' 1>&2; \
704 echo
'$(ME): skipping test $@: cppi not installed' 1>&2; \
707 # Enforce similar spec file indentation style, by running cppi on a
708 # (comment-only) C file that mirrors the same layout as the spec file.
710 @if cppi
--version
>/dev
/null
2>&1; then \
711 for f in
$$($(VC_LIST_EXCEPT
) |
$(GREP
) '\.spec\.in$$'); do \
712 $(SED
) -e
's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \
713 -e
's/%\(else\|endif\|define\)/#\1/' \
714 -e
's/^\( *\)\1\1\1#/#\1/' \
715 -e
's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \
716 | cppi
-a
-c
2>&1 |
$(SED
) "s|standard input|$$f|"; \
717 done |
{ if
$(GREP
) .
>&2; then false
; else :; fi
; } \
718 ||
{ echo
'$(ME): incorrect preprocessor indentation' 1>&2; \
721 echo
'$(ME): skipping test $@: cppi not installed' 1>&2; \
724 # Nested conditionals are easier to understand if we enforce that endifs
725 # can be paired back to the if
726 sc_makefile_conditionals
:
727 @prohibit
='(else|endif)($$| *#)' \
728 in_vc_files
='Makefile\.am' \
729 halt
='match "if FOO" with "endif FOO" in Makefiles' \
732 # Long lines can be harder to diff; too long, and git send-email chokes.
733 # For now, only enforce line length on files where we have intentionally
734 # fixed things and don't want to regress.
735 sc_prohibit_long_lines
:
737 in_vc_files
='\.arg[sv]' \
738 halt
='Wrap long lines in expected output files' \
741 in_vc_files
='Makefile\.am' \
742 halt
='Wrap long lines in Makefiles' \
746 @require
='Copyright .*Red 'Hat
', Inc\.' \
747 containing
='Copyright .*Red 'Hat \
748 halt
='Red Hat copyright is missing Inc.' \
750 @prohibit
='Copyright [^(].*Red 'Hat \
751 halt
='consistently use (C) in Red Hat copyright' \
753 @prohibit
='\<RedHat\>' \
754 halt
='spell Red Hat as two words' \
757 # Prefer the new URL listing over the old street address listing when
758 # calling out where to get a copy of the [L]GPL. Also, while we have
759 # to ship COPYING (GPL) alongside COPYING.LESSER (LGPL), we want any
760 # source file that calls out a top-level file to call out the LGPL
761 # version. Note that our typical copyright boilerplate refers to the
762 # license by name, not by reference to a top-level file.
764 @prohibit
=Boston
,' MA' \
765 halt
='Point to <http://www.gnu.org/licenses/>, not an address' \
767 @require
='COPYING\.LESSER' \
768 containing
='COPYING' \
769 halt
='Refer to COPYING.LESSER for LGPL' \
771 @prohibit
='COPYING\.LIB' \
772 halt
='Refer to COPYING.LESSER for LGPL' \
775 # Some functions/macros produce messages intended solely for developers
776 # and maintainers. Do not mark them for translation.
777 sc_prohibit_gettext_markup
:
778 @prohibit
='\<VIR_(WARN|INFO|DEBUG) *\(_\(' \
779 halt
='do not mark these strings for translation' \
782 # Our code is divided into modular subdirectories for a reason, and
783 # lower-level code must not include higher-level headers.
784 cross_dirs
=$(patsubst $(srcdir)/src
/%.
,%,$(wildcard $(srcdir)/src
/*/.
))
785 cross_dirs_re
=($(subst / ,/|
,$(cross_dirs
)))
786 mid_dirs
=access|admin|conf|cpu|locking|logging|rpc|security
787 sc_prohibit_cross_inclusion
:
788 @for
dir in
$(cross_dirs
); do \
790 util
/) safe
="util";; \
791 access
/ | conf
/) safe
="($$dir|conf|util)";; \
792 cpu
/| network
/| node_device
/| rpc
/| security
/| storage
/) \
793 safe
="($$dir|util|conf|storage)";; \
794 xenapi
/ | xenconfig
/ ) safe
="($$dir|util|conf|xen|cpu)";; \
795 *) safe
="($$dir|$(mid_dirs)|util)";; \
797 in_vc_files
="^src/$$dir" \
798 prohibit
='^# *include .$(cross_dirs_re)' \
799 exclude
="# *include .$$safe" \
800 halt
='unsafe cross-directory include' \
801 $(_sc_search_regexp
) \
804 # When converting an enum to a string, make sure that we track any new
805 # elements added to the enum by using a _LAST marker.
806 sc_require_enum_last_marker
:
807 @
$(VC_LIST_EXCEPT
) | xargs \
808 $(GREP
) -A1
-nE
'^[^#]*VIR_ENUM_IMPL *\(' /dev
/null \
809 |
$(SED
) -ne
'/VIR_ENUM_IMPL.*,$$/N' \
810 -e
'/VIR_ENUM_IMPL[^,]*,[^,]*,[^,]*[^_,][^L,][^A,][^S,][^T,],/p' \
811 -e
'/VIR_ENUM_IMPL[^,]*,[^,]\{0,4\},/p' \
813 { echo
'$(ME): enum impl needs _LAST marker on second line' 1>&2; \
816 # In Python files we don't want to end lines with a semicolon like in C
817 sc_prohibit_semicolon_at_eol_in_python
:
818 @prohibit
='^[^#].*\;$$' \
819 in_vc_files
='\.py$$' \
820 halt
='python does not require to end lines with a semicolon' \
823 # mymain() in test files should use return, not exit, for nicer output
824 sc_prohibit_exit_in_tests
:
825 @prohibit
='\<exit *\(' \
826 in_vc_files
='tests/.*\.c$$' \
827 halt
='use return, not exit(), in tests' \
830 # Don't include "libvirt/*.h" in "" form.
831 sc_prohibit_include_public_headers_quote
:
832 @prohibit
='# *include *"libvirt/.*\.h"' \
833 in_vc_files
='\.[ch]$$' \
834 halt
='Do not include libvirt/*.h in internal source' \
837 # Don't include "libvirt/*.h" in <> form. Except for external tools,
838 # e.g. Python binding, examples and tools subdirectories.
839 sc_prohibit_include_public_headers_brackets
:
840 @prohibit
='# *include *<libvirt/.*\.h>' \
841 in_vc_files
='\.[ch]$$' \
842 halt
='Do not include libvirt/*.h in internal source' \
845 # <config.h> is only needed in .c files; .h files do not need it since
846 # .c files must include config.h before any other .h.
847 sc_prohibit_config_h_in_headers
:
848 @prohibit
='^# *include\>.*config\.h' \
849 in_vc_files
='\.h$$' \
850 halt
='headers should not include <config.h>' \
853 sc_prohibit_unbounded_arrays_in_rpc
:
855 in_vc_files
='\.x$$' \
856 halt
='Arrays in XDR must have a upper limit set for <NNN>' \
860 @prohibit
='\bato(i|f|l|ll|q) *\(' \
861 halt
='Use virStrToLong* instead of atoi, atol, atof, atoq, atoll' \
864 sc_prohibit_wrong_filename_in_comment
:
865 @
$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[ch]$$' | xargs awk
'BEGIN { \
868 n=match($$0, /[[:space:]][^[:space:]]*[.][ch][[:space:]:]/); \
870 A=substr($$0, RSTART+1, RLENGTH-2); \
871 n=split(FILENAME, arr, "/"); \
873 print "in " FILENAME ": " A " mentioned in comments "; \
881 }' ||
{ echo
'$(ME): The file name in comments must match the' \
882 'actual file name' 1>&2; exit
1; }
884 sc_prohibit_virConnectOpen_in_virsh
:
885 @prohibit
='\bvirConnectOpen[a-zA-Z]* *\(' \
886 in_vc_files
='tools/virsh-.*\.[ch]$$' \
887 halt
='Use vshConnect() in virsh instead of virConnectOpen*' \
890 sc_require_space_before_label
:
891 @prohibit
='^( ?)?[_a-zA-Z0-9]+:$$' \
892 in_vc_files
='\.[ch]$$' \
893 halt
='Top-level labels should be indented by one space' \
896 # Allow for up to three spaces before the label: this is to avoid running
897 # into situations where neither this rule nor require_space_before_label
898 # would apply, eg. a line matching ^[a-zA-Z0-9]+ :$
899 sc_prohibit_space_in_label
:
900 @prohibit
='^ {0,3}[_a-zA-Z0-9]+ +:$$' \
901 in_vc_files
='\.[ch]$$' \
902 halt
='There should be no space between label name and colon' \
905 # Doesn't catch all cases of mismatched braces across if-else, but it helps
906 sc_require_if_else_matching_braces
:
907 @prohibit
='( else( if .*\))? {|} else( if .*\))?$$)' \
908 in_vc_files
='\.[chx]$$' \
909 halt
='if one side of if-else uses {}, both sides must use it' \
912 sc_curly_braces_style
:
913 @if
$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[ch]$$' | xargs
$(GREP
) -nHP \
914 '^\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)\) ?\{' \
916 echo
'$(ME): Non-K&R style used for curly braces around' \
917 'function body' 1>&2; exit
1; \
919 if
$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[ch]$$' | xargs \
920 $(GREP
) -A1
-En
' ((if|for|while|switch) \(|(else|do)\b)[^{]*$$' \
921 /dev
/null |
$(GREP
) '^[^ ]*- *{'; then \
922 echo
'$(ME): Use hanging braces for compound statements' 1>&2; exit
1; \
925 sc_prohibit_windows_special_chars_in_filename
:
926 @
$(VC_LIST_EXCEPT
) |
$(GREP
) '[:*?"<>|]' && \
927 { echo
'$(ME): Windows special chars in filename not allowed' 1>&2; echo exit
1; } ||
:
929 sc_prohibit_mixed_case_abbreviations
:
930 @prohibit
='Pci|Usb|Scsi' \
931 in_vc_files
='\.[ch]$$' \
932 halt
='Use PCI, USB, SCSI, not Pci, Usb, Scsi' \
935 # Require #include <locale.h> in all files that call setlocale()
937 @require
='include.*locale\.h' \
938 containing
='setlocale *(' \
939 halt
='setlocale() requires <locale.h>' \
942 sc_prohibit_empty_first_line
:
943 @
$(VC_LIST_EXCEPT
) | xargs awk
'BEGIN { fail=0; } \
944 FNR == 1 { if ($$0 == "") { print FILENAME ":1:"; fail=1; } } \
945 END { if (fail == 1) { \
946 print "$(ME): Prohibited empty first line" > "/dev/stderr"; \
949 sc_prohibit_paren_brace
:
951 in_vc_files
='\.[chx]$$' \
952 halt
='Put space between closing parenthesis and opening brace' \
955 # C guarantees that static variables are zero initialized, and some compilers
956 # waste space by sticking explicit initializers in .data instead of .bss
957 sc_prohibit_static_zero_init
:
958 @prohibit
='\bstatic\b.*= *(0[^xX0-9]|NULL|false)' \
959 in_vc_files
='\.[chx](\.in)?$$' \
960 halt
='static variables do not need explicit zero initialization'\
963 # FreeBSD exports the "devname" symbol which produces a warning.
965 @prohibit
='\bdevname\b' \
966 exclude
='sc_prohibit_devname' \
967 halt
='avoid using devname as FreeBSD exports the symbol' \
970 sc_prohibit_system_error_with_vir_err
:
971 @prohibit
='\bvirReportSystemError *\(VIR_ERR_' \
972 halt
='do not use virReportSystemError with VIR_ERR_* error codes' \
975 # Rule to prohibit usage of virXXXFree within library, daemon, remote, etc.
976 # functions. There's a corresponding exclude to allow usage within tests,
977 # docs, examples, tools, src/libvirt-*.c, and include/libvirt/libvirt-*.h
978 sc_prohibit_virXXXFree
:
979 @prohibit
='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter|Interface|DomainSnapshot)Free\b' \
980 exclude
='sc_prohibit_virXXXFree' \
981 halt
='avoid using virXXXFree, use virObjectUnref instead' \
984 sc_prohibit_sysconf_pagesize
:
985 @prohibit
='sysconf\(_SC_PAGESIZE' \
986 halt
='use virGetSystemPageSize[KB] instead of sysconf(_SC_PAGESIZE)' \
989 sc_prohibit_virSecurity
:
990 @
$(VC_LIST_EXCEPT
) |
$(GREP
) 'src/qemu/' | \
991 $(GREP
) -v
'src/qemu/qemu_security' | \
992 xargs
$(GREP
) -Pn
'virSecurityManager(?!Ptr)' /dev
/null
&& \
993 { echo
'$(ME): prefer qemuSecurity wrappers' 1>&2; exit
1; } ||
:
995 sc_prohibit_pthread_create
:
996 @prohibit
='\bpthread_create\b' \
997 exclude
='sc_prohibit_pthread_create' \
998 halt
='avoid using pthread_create, use virThreadCreate instead' \
1001 sc_prohibit_not_streq
:
1002 @prohibit
='! *STRN?EQ *\(.*\)' \
1003 halt
='Use STRNEQ instead of !STREQ and STREQ instead of !STRNEQ' \
1004 $(_sc_search_regexp
)
1006 sc_prohibit_verbose_strcat
:
1007 @prohibit
='strncat\([^,]*,\s+([^,]*),\s+strlen\(\1\)\)' \
1008 in_vc_files
='\.[ch]$$' \
1009 halt
='Use strcat(a, b) instead of strncat(a, b, strlen(b))' \
1010 $(_sc_search_regexp
)
1012 # Ensure that each .c file containing a "main" function also
1013 # calls virGettextInitialize
1015 @require
='virGettextInitialize *\(' \
1016 in_vc_files
='\.c$$' \
1017 containing
='\<main *(' \
1018 halt
='the above files do not call virGettextInitialize' \
1019 $(_sc_search_regexp
)
1021 sc_prohibit_obj_free_apis_in_virsh
:
1022 @prohibit
='\bvir(Domain|DomainSnapshot)Free\b' \
1023 in_vc_files
='virsh.*\.[ch]$$' \
1024 exclude
='sc_prohibit_obj_free_apis_in_virsh' \
1025 halt
='avoid using virDomain(Snapshot)Free in virsh, use virsh-prefixed wrappers instead' \
1026 $(_sc_search_regexp
)
1028 https_sites
= www.libvirt.org
1029 https_sites
+= libvirt.org
1030 https_sites
+= security.libvirt.org
1031 https_sites
+= qemu.org
1032 https_sites
+= www.qemu.org
1033 https_sites
+= wiki.qemu.org
1034 https_sites
+= linux-kvm.org
1035 https_sites
+= www.linux-kvm.org
1037 https_re
= ($(subst $(space
),|
,$(https_sites
)))
1039 sc_prohibit_http_urls
:
1040 @prohibit
='http://$(https_re)' \
1041 exclude
="/schemas/" \
1042 halt
='Links must use https:// protocol' \
1043 $(_sc_search_regexp
)
1046 @prohibit
="(\*|#)\s*(A|a)uthors?:" \
1047 halt
="Author: statements are prohibited in source comments" \
1048 $(_sc_search_regexp
)
1050 # Alignment is usually achieved through spaces (at least two of them)
1051 # or tabs (at least one of them) right before the trailing backslash
1052 sc_prohibit_backslash_alignment
:
1053 @prohibit
='( | )\\$$' \
1054 in_vc_files
='*\.([chx]|am|mk)$$' \
1055 halt
='Do not attempt to right-align backslashes' \
1056 $(_sc_search_regexp
)
1058 # Some syntax rules pertaining to the usage of cleanup macros
1059 # implementing GNU C's cleanup attribute
1061 # Rule to ensure that variables declared using a cleanup macro are
1062 # always initialized.
1063 sc_require_attribute_cleanup_initialization
:
1064 @prohibit
='VIR_AUTO((FREE|PTR|UNREF|CLEAN)\(.+\)|CLOSE|STRINGLIST) *[^=]+;' \
1065 in_vc_files
='\.[chx]$$' \
1066 halt
='variable declared with a cleanup macro must be initialized' \
1067 $(_sc_search_regexp
)
1069 # "class" in headers is not good because by default Vim treats it as a keyword
1070 # Let's prohibit it in source files as well.
1072 @prohibit
=' +_?class *;' \
1073 in_vc_files
='\.[chx]$$' \
1074 halt
='use klass instead of class or _class' \
1075 $(_sc_search_regexp
)
1077 # The dirent "d_type" field is non-portable and even when it
1078 # exists some filesystems will only ever return DT_UNKNOWN.
1079 # This field should only be used by code which is exclusively
1080 # run platforms supporting "d_type" and must expect DT_UNKNOWN.
1081 # We blacklist it to discourage accidental usage which has
1082 # happened many times. Add an exclude rule if it is genuinely
1083 # needed and the above restrictions are acceptable.
1084 sc_prohibit_dirent_d_type
:
1085 @prohibit
='(->|\.)d_type' \
1086 in_vc_files
='\.[chx]$$' \
1087 halt
='do not use the d_type field in "struct dirent"' \
1088 $(_sc_search_regexp
)
1091 # We don't use this feature of maint.mk.
1092 prev_version_file
= /dev
/null
1094 ifneq ($(_gl-Makefile
),)
1095 ifeq (0,$(MAKELEVEL
))
1096 _dry_run_result
:= $(shell \
1098 test -d .git ||
test -f .git ||
{ echo
0; exit
; }; \
1099 $(srcdir)/autogen.sh
--dry-run
>/dev
/null
2>&1; \
1102 _clean_requested
= $(filter %clean,$(MAKECMDGOALS
))
1104 # A return value of 0 means no action is required
1106 # A return value of 1 means a genuine error has occurred while
1107 # performing the dry run, and it should be reported so it can
1109 ifeq (1,$(_dry_run_result
))
1110 $(info INFO
: autogen.sh error
, running again to show details
)
1111 maint.mk Makefile
: _autogen_error
1114 # A return value of 2 means that autogen.sh needs to be executed
1115 # in earnest before building, probably because of gnulib updates.
1116 # We don't run autogen.sh if the clean target has been invoked,
1117 # though, as it would be quite pointless
1118 ifeq (2,$(_dry_run_result
)$(_clean_requested
))
1119 $(info INFO
: running autogen.sh is required
, running it now...
)
1120 $(shell touch
$(srcdir)/AUTHORS
)
1121 maint.mk Makefile
: _autogen
1126 # It is necessary to call autogen any time gnulib changes. Autogen
1127 # reruns configure, then we regenerate all Makefiles at once.
1130 $(srcdir)/autogen.sh
1133 .PHONY
: _autogen_error
1135 $(srcdir)/autogen.sh
--dry-run
1137 ifneq ($(_gl-Makefile
),)
1138 syntax-check
: spacing-check test-wrap-argv \
1139 prohibit-duplicate-header mock-noinline group-qemu-caps \
1141 @if
! cppi
--version
>/dev
/null
2>&1; then \
1142 echo
"*****************************************************" >&2; \
1143 echo
"* cppi not installed, some checks have been skipped *" >&2; \
1144 echo
"*****************************************************" >&2; \
1148 # Don't include duplicate header in the source (either *.c or *.h)
1149 prohibit-duplicate-header
:
1150 $(AM_V_GEN
)$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[chx]$$' | xargs \
1151 $(PERL
) -W
$(top_srcdir
)/build-aux
/prohibit-duplicate-header.pl
1154 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) '\.c$$' | xargs \
1155 $(PERL
) $(top_srcdir
)/build-aux
/check-spacing.pl || \
1156 { echo
'$(ME): incorrect formatting' 1>&2; exit
1; }
1159 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) '\.[ch]$$' | xargs \
1160 $(PERL
) $(top_srcdir
)/build-aux
/mock-noinline.pl
1163 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) '\.[h]$$' | xargs \
1164 $(PERL
) $(top_srcdir
)/build-aux
/header-ifdef.pl
1167 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) -E
'\.(ldargs|args)' | xargs \
1168 $(PERL
) $(top_srcdir
)/tests
/test-wrap-argv.pl
--check
1171 $(AM_V_GEN
)$(PERL
) $(top_srcdir
)/tests
/group-qemu-caps.pl
--check $(top_srcdir
)/
1173 # sc_po_check can fail if generated files are not built first
1175 $(srcdir)/src
/remote
/remote_daemon_dispatch_stubs.h \
1176 $(srcdir)/src
/remote
/remote_daemon_dispatch_qemu_stubs.h \
1177 $(srcdir)/src
/remote
/remote_client_bodies.h \
1178 $(srcdir)/src
/admin
/admin_server_dispatch_stubs.h \
1179 $(srcdir)/src
/admin
/admin_client.h
1180 $(srcdir)/src
/remote
/remote_daemon_dispatch_stubs.h
: $(srcdir)/src
/remote
/remote_protocol.x
1181 $(MAKE
) -C src remote
/remote_daemon_dispatch_stubs.h
1182 $(srcdir)/src
/remote
/remote_daemon_dispatch_qemu_stubs.h
: $(srcdir)/src
/remote
/qemu_protocol.x
1183 $(MAKE
) -C src remote
/remote_daemon_dispatch_qemu_stubs.h
1184 $(srcdir)/src
/remote
/remote_client_bodies.h
: $(srcdir)/src
/remote
/remote_protocol.x
1185 $(MAKE
) -C src remote
/remote_client_bodies.h
1186 $(srcdir)/src
/admin
/admin_server_dispatch_stubs.h
: $(srcdir)/src
/admin
/admin_protocol.x
1187 $(MAKE
) -C src admin
/admin_server_dispatch_stubs.h
1188 $(srcdir)/src
/admin
/admin_client.h
: $(srcdir)/src
/admin
/admin_protocol.x
1189 $(MAKE
) -C src admin
/admin_client.h
1191 # List all syntax-check exemptions:
1192 exclude_file_name_regexp--sc_avoid_strcase
= ^tools
/vsh\.h
$$
1194 _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
1195 _test1
=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock|commandhelper
1196 exclude_file_name_regexp--sc_avoid_write
= \
1197 ^
(src
/($(_src1
))|tools
/virsh-console|tests
/($(_test1
)))\.c
$$
1199 exclude_file_name_regexp--sc_bindtextdomain
= .
*
1201 exclude_file_name_regexp--sc_gettext_init
= ^
((tests|examples
)/|tools
/virt-login-shell.c
)
1203 exclude_file_name_regexp--sc_copyright_format
= \
1206 exclude_file_name_regexp--sc_copyright_usage
= \
1207 ^COPYING
(|\.LESSER
)$$
1209 exclude_file_name_regexp--sc_flags_usage
= \
1210 ^
(cfg\.mk|docs
/|src
/util
/virnetdevtap\.c
$$|tests
/((vir
(cgroup|pci|
test|usb
)|nss|qemuxml2argv|qemusecurity
)mock|virfilewrapper
)\.c
$$)
1212 exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics
= \
1213 ^
(src
/rpc
/gendispatch\.pl
$$|tests
/)
1215 exclude_file_name_regexp--sc_po_check
= ^
(docs
/|src
/rpc
/gendispatch\.pl
$$)
1217 exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY
= \
1218 ^
(cfg\.mk|
include/libvirt
/virterror\.h|src
/remote
/remote_daemon_dispatch\.c|src
/util
/virerror\.c|docs
/internals
/oomtesting\.html\.in
)$$
1220 exclude_file_name_regexp--sc_prohibit_PATH_MAX
= \
1223 exclude_file_name_regexp--sc_prohibit_access_xok
= \
1224 ^
(cfg\.mk|src
/util
/virutil\.c
)$$
1226 exclude_file_name_regexp--sc_prohibit_asprintf
= \
1227 ^
(cfg\.mk|bootstrap.conf
$$|examples
/|src
/util
/virstring\.
[ch
]$$|tests
/vircgroupmock\.c|tools
/virt-login-shell\.c|tools
/nss
/libvirt_nss\.c
$$)
1229 exclude_file_name_regexp--sc_prohibit_strdup
= \
1230 ^
(docs
/|examples
/|src
/util
/virstring\.c|tests
/vir
(netserverclient|cgroup
)mock.c|tests
/commandhelper\.c|tools
/nss
/libvirt_nss_
(leases|macs
)\.c
$$)
1232 exclude_file_name_regexp--sc_prohibit_close
= \
1233 (\.p
[yl
]$$|\.spec\.in
$$|^docs
/|^
(src
/util
/virfile\.c|src
/libvirt-stream\.c|tests
/(vir.
+mock\.c|commandhelper\.c|qemusecuritymock\.c
)|tools
/nss
/libvirt_nss_
(leases|macs
)\.c
)$$)
1235 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF
= \
1236 (^tests
/(virhostcpu|virpcitest
)data
/|docs
/js
/.
*\.js|docs
/fonts
/.
*\.woff|\.diff|tests
/virconfdata
/no-newline\.conf
$$)
1238 _src2
=src
/(util
/vircommand|libvirt|lxc
/lxc_controller|locking
/lock_daemon|logging
/log_daemon|remote
/remote_daemon
)
1239 exclude_file_name_regexp--sc_prohibit_fork_wrappers
= \
1240 (^
($(_src2
)|tests
/testutils
)\.c
$$)
1242 exclude_file_name_regexp--sc_prohibit_gethostname
= ^src
/util
/vir
(util|log
)\.c
$$
1244 exclude_file_name_regexp--sc_prohibit_internal_functions
= \
1245 ^src
/(util
/(viralloc|virutil|virfile
)\.
[hc
]|esx
/esx_vi\.c
)$$
1247 exclude_file_name_regexp--sc_prohibit_raw_virclassnew
= \
1248 ^src
/util
/virobject\.
[hc
]$$
1250 exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic
= \
1251 ^src
/rpc
/gendispatch\.pl
$$
1253 exclude_file_name_regexp--sc_prohibit_nonreentrant
= \
1254 ^
((po|tests|examples
)/|docs
/.
*(py|js|html\.in
)|run.in
$$|tools
/wireshark
/util
/genxdrstub\.pl|tools
/virt-login-shell\.c
$$)
1256 exclude_file_name_regexp--sc_prohibit_select
= \
1259 exclude_file_name_regexp--sc_prohibit_canonicalize_file_name
= \
1260 ^
(cfg\.mk|tests
/virfilemock\.c
)$$
1262 exclude_file_name_regexp--sc_prohibit_raw_allocation
= \
1263 ^
(docs
/hacking\.html\.in|src
/util
/viralloc\.
[ch
]|examples
/.
*|tests
/(securityselinuxhelper|
(vircgroup|nss
)mock|commandhelper
)\.c|tools
/wireshark
/src
/packet-libvirt\.c|tools
/nss
/libvirt_nss
(_leases|_macs
)?\.c
)$$
1265 exclude_file_name_regexp--sc_prohibit_readlink
= \
1266 ^src
/(util
/virutil|lxc
/lxc_container
)\.c
$$
1268 exclude_file_name_regexp--sc_prohibit_setuid
= ^src
/util
/virutil\.c|tools
/virt-login-shell\.c
$$
1270 exclude_file_name_regexp--sc_prohibit_sprintf
= \
1271 ^
(cfg\.mk|docs
/hacking\.html\.in|.
*\.stp|.
*\.pl
)$$
1273 exclude_file_name_regexp--sc_prohibit_strncpy
= ^src
/util
/virstring\.c
$$
1275 exclude_file_name_regexp--sc_prohibit_strtol
= ^examples
/.
*$$
1277 exclude_file_name_regexp--sc_prohibit_xmlGetProp
= ^src
/util
/virxml\.c
$$
1279 exclude_file_name_regexp--sc_prohibit_xmlURI
= ^src
/util
/viruri\.c
$$
1281 exclude_file_name_regexp--sc_prohibit_return_as_function
= \.py
$$
1283 exclude_file_name_regexp--sc_require_config_h
= \
1284 ^
(examples
/|tools
/virsh-edit\.c
$$|tests
/virmockstathelpers.c
)
1286 exclude_file_name_regexp--sc_require_config_h_first
= \
1287 ^
(examples
/|tools
/virsh-edit\.c
$$|tests
/virmockstathelpers.c
)
1289 exclude_file_name_regexp--sc_trailing_blank
= \
1290 /sysinfodata
/.
*\.data|
/virhostcpudata
/.
*\.cpuinfo|^gnulib
/local
/.
*/.
*diff
$$
1292 exclude_file_name_regexp--sc_unmarked_diagnostics
= \
1293 ^
(docs
/apibuild.py|tests
/virt-aa-helper-test|docs
/js
/.
*\.js
)$$
1295 exclude_file_name_regexp--sc_size_of_brackets
= cfg.mk
1297 exclude_file_name_regexp--sc_correct_id_types
= \
1298 (^src
/locking
/lock_protocol.x
$$)
1300 exclude_file_name_regexp--sc_m4_quote_check
= m4
/virt-lib.m4
1302 exclude_file_name_regexp--sc_prohibit_include_public_headers_quote
= \
1303 ^
(src
/internal\.h
$$|tools
/wireshark
/src
/packet-libvirt.c
$$)
1305 exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets
= \
1306 ^
(tools
/|examples
/|
include/libvirt
/(virterror|libvirt
(-(admin|qemu|lxc
))?
)\.h
$$)
1308 exclude_file_name_regexp--sc_prohibit_int_ijk
= \
1309 ^
(src
/remote_protocol-structs|src
/remote
/remote_protocol\.x|cfg\.mk|
include/libvirt
/libvirt.
+|src
/admin_protocol-structs|src
/admin
/admin_protocol\.x
)$$
1311 exclude_file_name_regexp--sc_prohibit_unsigned_pid
= \
1312 ^
(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
)$$
1314 exclude_file_name_regexp--sc_avoid_attribute_unused_in_header
= \
1315 ^
(src
/util
/virlog\.h|src
/network
/bridge_driver\.h
)$$
1317 exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations
= \
1318 ^src
/(vbox
/vbox_CAPI.
*.h|esx
/esx_vi.
(c|h
)|esx
/esx_storage_backend_iscsi.c
)$$
1320 exclude_file_name_regexp--sc_prohibit_empty_first_line
= \
1321 ^
(README|src
/esx
/README|tests
/(vmwarever|virhostcpu
)data
/.
*)$$
1323 exclude_file_name_regexp--sc_prohibit_useless_translation
= \
1324 ^tests
/virpolkittest.c
1326 exclude_file_name_regexp--sc_prohibit_devname
= \
1327 ^
(tools
/virsh.pod|cfg.mk|docs
/.
*)$$
1329 exclude_file_name_regexp--sc_prohibit_virXXXFree
= \
1330 ^
(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
$$)
1332 exclude_file_name_regexp--sc_prohibit_sysconf_pagesize
= \
1333 ^
(cfg\.mk|src
/util
/virutil\.c
)$$
1335 exclude_file_name_regexp--sc_prohibit_pthread_create
= \
1336 ^
(cfg\.mk|src
/util
/virthread\.c|tests
/.
*)$$
1338 exclude_file_name_regexp--sc_prohibit_always-defined_macros
= \
1339 ^tests
/virtestmock.c
$$
1341 exclude_file_name_regexp--sc_prohibit_readdir
= \
1342 ^
(tests
/(.
*mock|virfilewrapper
)\.c|tools
/nss
/libvirt_nss\.c
)$$
1344 exclude_file_name_regexp--sc_prohibit_cross_inclusion
= \
1345 ^
(src
/util
/virclosecallbacks\.h|src
/util
/virhostdev\.h
)$$
1347 exclude_file_name_regexp--sc_prohibit_dirent_d_type
= \
1348 ^
(src
/util
/vircgroup.c
)$
1350 exclude_file_name_regexp--sc_prohibit_strcmp
= \
1351 ^
(tools
/nss
/libvirt_nss.
*\.c
)