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
=virNWFilterDefFree \
150 --name
=virNWFilterEntryFree \
151 --name
=virNWFilterHashTableFree \
152 --name
=virNWFilterIPAddrLearnReqFree \
153 --name
=virNWFilterIncludeDefFree \
154 --name
=virNWFilterObjFree \
155 --name
=virNWFilterRuleDefFree \
156 --name
=virNWFilterRuleInstFree \
157 --name
=virNetworkDefFree \
158 --name
=virNodeDeviceDefFree \
159 --name
=virNodeDeviceObjFree \
160 --name
=virObjectUnref \
161 --name
=virObjectFreeCallback \
162 --name
=virPCIDeviceFree \
163 --name
=virSecretDefFree \
164 --name
=virStorageEncryptionFree \
165 --name
=virStorageEncryptionSecretFree \
166 --name
=virStorageFileFreeMetadata \
167 --name
=virStoragePoolDefFree \
168 --name
=virStoragePoolObjFree \
169 --name
=virStoragePoolSourceFree \
170 --name
=virStorageVolDefFree \
171 --name
=virThreadPoolFree \
172 --name
=xmlBufferFree \
176 --name
=xmlXPathFreeContext \
177 --name
=xmlXPathFreeObject
179 # The following template was generated by this command:
180 # make ID && aid free|grep '^vi'|sed 's/ .*//;s/^/# /'
181 # N virBufferFreeAndReset
183 # y virCapabilitiesFree
184 # y virCapabilitiesFreeGuest
185 # y virCapabilitiesFreeGuestDomain
186 # y virCapabilitiesFreeGuestFeature
187 # y virCapabilitiesFreeGuestMachine
188 # y virCapabilitiesFreeHostNUMACell
189 # y virCapabilitiesFreeMachines
190 # N virCapabilitiesFreeNUMAInfo FIXME
192 # N virConfFree (diagnoses the "error")
195 # y virDomainChrDefFree
196 # y virDomainControllerDefFree
198 # y virDomainDeviceDefFree
199 # y virDomainDiskDefFree
200 # y virDomainEventCallbackListFree
201 # y virDomainEventQueueFree
202 # y virDomainFSDefFree
204 # n virDomainFreeName (can't fix -- returns int)
205 # y virDomainGraphicsDefFree
206 # y virDomainHostdevDefFree
207 # y virDomainInputDefFree
208 # y virDomainNetDefFree
210 # n virDomainSnapshotFree (returns int)
211 # n virDomainSnapshotFreeName (returns int)
212 # y virDomainSnapshotObjFree
213 # y virDomainSoundDefFree
214 # y virDomainVideoDefFree
215 # y virDomainWatchdogDefFree
216 # n virDrvNodeGetCellsFreeMemory (returns int)
217 # n virDrvNodeGetFreeMemory (returns long long)
218 # n virFree - dereferences param
220 # n virHashFree (takes 2 args)
221 # y virInterfaceDefFree
222 # n virInterfaceFree (returns int)
223 # n virInterfaceFreeName
224 # y virInterfaceIpDefFree
225 # y virInterfaceObjFree
226 # n virInterfaceObjListFree
227 # y virInterfaceProtocolDefFree
229 # y virLastErrFreeData
230 # y virNWFilterDefFree
231 # y virNWFilterEntryFree
232 # n virNWFilterFree (returns int)
233 # y virNWFilterHashTableFree
234 # y virNWFilterIPAddrLearnReqFree
235 # y virNWFilterIncludeDefFree
236 # n virNWFilterFreeName (returns int)
237 # y virNWFilterObjFree
238 # n virNWFilterObjListFree FIXME
239 # y virNWFilterRuleDefFree
240 # n virNWFilterRuleFreeInstanceData (typedef)
241 # y virNWFilterRuleInstFree
242 # y virNetworkDefFree
243 # n virNetworkFree (returns int)
244 # n virNetworkFreeName (returns int)
245 # n virNodeDevCapsDefFree FIXME
246 # y virNodeDeviceDefFree
247 # n virNodeDeviceFree (returns int)
248 # y virNodeDeviceObjFree
249 # n virNodeDeviceObjListFree FIXME
250 # n virNodeGetCellsFreeMemory (returns int)
251 # n virNodeGetFreeMemory (returns non-void)
253 # n virSecretFree (returns non-void)
254 # n virSecretFreeName (2 args)
255 # n virSecurityLabelDefFree FIXME
256 # n virStorageBackendDiskMakeFreeExtent (returns non-void)
257 # y virStorageEncryptionFree
258 # y virStorageEncryptionSecretFree
259 # n virStorageFreeType (enum)
260 # y virStoragePoolDefFree
261 # n virStoragePoolFree (returns non-void)
262 # n virStoragePoolFreeName (returns non-void)
263 # y virStoragePoolObjFree
264 # n virStoragePoolObjListFree FIXME
265 # y virStoragePoolSourceFree
266 # y virStorageVolDefFree
267 # n virStorageVolFree (returns non-void)
268 # n virStorageVolFreeName (returns non-void)
271 # Avoid uses of write(2). Either switch to streams (fwrite), or use
272 # the safewrite wrapper.
274 @prohibit
='\<write *\(' \
275 in_vc_files
='\.c$$' \
276 halt
='consider using safewrite instead of write' \
279 # In debug statements, print flags as bitmask and mode_t as octal.
281 @prohibit
='\<mode=%[0-9.]*[diuxo]' \
282 halt
='use \"0%o\" to debug mode_t values' \
284 @prohibit
='[Ff]lags=%[0-9.]*l*[dioux]' \
285 halt
='use \"0x%x\" to debug flag values' \
288 # Prefer 'unsigned int flags', along with checks for unknown flags.
289 # For historical reasons, we are stuck with 'unsigned long flags' in
290 # migration, so check for those known 4 instances and no more in public
291 # API. Also check that no flags are marked unused, and 'unsigned' should
292 # appear before any declaration of a flags variable (achieved by
293 # prohibiting the word prior to the type from ending in anything other
294 # than d). The existence of long long, and of documentation about
295 # flags, makes the regex in the third test slightly harder.
297 @
test "$$(cat $(srcdir)/include/libvirt/libvirt-domain.h \
298 $(srcdir)/include/libvirt/virterror.h \
299 $(srcdir)/include/libvirt/libvirt-qemu.h \
300 $(srcdir)/include/libvirt/libvirt-lxc.h \
301 $(srcdir)/include/libvirt/libvirt-admin.h \
302 | $(GREP) -c '\(long\|unsigned\) flags')" != 4 && \
303 { echo
'$(ME): new API should use "unsigned int flags"' 1>&2; \
305 @prohibit
=' flags ATTRIBUTE_UNUSED' \
306 exclude
='virSecurityDomainImageLabelFlags' \
307 halt
='flags should be checked with virCheckFlags' \
309 @prohibit
='^[^@]*([^d] (int|long long)|[^dg] long) flags[;,)]' \
310 halt
='flags should be unsigned' \
313 # Avoid functions that should only be called via macro counterparts.
314 sc_prohibit_internal_functions
:
315 @prohibit
='vir(Free|AllocN?|ReallocN|(Insert|Delete)ElementsN|File(Close|Fclose|Fdopen)) *\(' \
316 halt
='use VIR_ macros instead of internal functions' \
319 sc_prohibit_raw_virclassnew
:
320 @prohibit
='virClassNew *\(' \
321 halt
='use VIR_CLASS_NEW instead of virClassNew' \
324 # Avoid raw malloc and free, except in documentation comments.
325 sc_prohibit_raw_allocation
:
326 @prohibit
='^.[^*].*\<((m|c|re)alloc|free) *\([^)]' \
327 halt
='use VIR_ macros from viralloc.h instead of malloc/free' \
330 # Avoid functions that can lead to double-close bugs.
332 @prohibit
='([^>.]|^)\<[fp]?close *\(' \
333 halt
='use VIR_{FORCE_}[F]CLOSE instead of [f]close' \
335 @prohibit
='\<fdopen *\(' \
336 halt
='use VIR_FDOPEN instead of fdopen' \
339 # Prefer virCommand for all child processes.
340 sc_prohibit_fork_wrappers
:
341 @prohibit
='= *\<(fork|popen|system) *\(' \
342 halt
='use virCommand for child processes' \
345 # Prefer mkostemp with O_CLOEXEC.
347 @prohibit
='[^"]\<mkstemps? *\(' \
348 halt
='use mkostemp with O_CLOEXEC instead of mkstemp' \
351 # access with X_OK accepts directories, but we can't exec() those.
352 # access with F_OK or R_OK is okay, though.
353 sc_prohibit_access_xok
:
354 @prohibit
='access(at)? *\(.*X_OK' \
355 halt
='use virFileIsExecutable instead of access(,X_OK)' \
358 # Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
359 # Use STREQLEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
360 snp_
= strncmp
*\
(.
+\
)
362 @prohibit
='! *strncmp *\(|\<$(snp_) *[!=]=|[!=]= *$(snp_)' \
363 exclude
=':# *define STR(N?EQLEN|PREFIX)\(' \
364 halt
='use STREQLEN or STRPREFIX instead of strncmp' \
367 # strtol and friends are too easy to misuse
369 @prohibit
='\bstrto(u?ll?|[ui]max) *\(' \
370 exclude
='exempt from syntax-check' \
371 halt
='use virStrToLong_*, not strtol variants' \
373 @prohibit
='\bstrto[df] *\(' \
374 exclude
='exempt from syntax-check' \
375 halt
='use virStrToDouble, not strtod variants' \
378 # Use virAsprintf rather than as'printf since *strp is undefined on error.
379 # But for plain %s, virAsprintf is overkill compared to strdup.
380 sc_prohibit_asprintf
:
381 @prohibit
='\<v?a[s]printf\>' \
382 halt
='use virAsprintf, not asprintf' \
384 @prohibit
='virAsprintf.*, *"%s",' \
385 halt
='use VIR_STRDUP instead of virAsprintf with "%s"' \
389 @prohibit
='\<strn?dup\> *\(' \
390 halt
='use VIR_STRDUP, not strdup' \
393 # Prefer virSetUIDGID.
395 @prohibit
='\<set(re)?[ug]id\> *\(' \
396 halt
='use virSetUIDGID, not raw set*id' \
399 # Don't compare *id_t against raw -1.
400 sc_prohibit_risky_id_promotion
:
401 @prohibit
='\b(user|group|[ug]id) *[=!]= *-' \
402 halt
='cast -1 to ([ug]id_t) before comparing against id' \
405 # Use snprintf rather than s'printf, even if buffer is provably large enough,
406 # since gnulib has more guarantees for snprintf portability
408 @prohibit
='\<[s]printf\>' \
409 halt
='use snprintf, not sprintf' \
412 sc_prohibit_readlink
:
413 @prohibit
='\<readlink *\(' \
414 halt
='use virFileResolveLink, not readlink' \
417 sc_prohibit_gethostname
:
418 @prohibit
='gethostname *\(' \
419 halt
='use virGetHostname, not gethostname' \
423 @prohibit
='\b(read|close|open)dir *\(' \
424 exclude
='exempt from syntax-check' \
425 halt
='use virDirOpen, virDirRead and VIR_DIR_CLOSE' \
428 sc_prohibit_gettext_noop
:
429 @prohibit
='gettext_noop *\(' \
430 halt
='use N_, not gettext_noop' \
433 sc_prohibit_VIR_ERR_NO_MEMORY
:
434 @prohibit
='\<VIR_ERR_NO_MEMORY\>' \
435 halt
='use virReportOOMError, not VIR_ERR_NO_MEMORY' \
438 sc_prohibit_PATH_MAX
:
439 @prohibit
='\<PATH_MAX\>' \
440 halt
='dynamically allocate paths, do not use PATH_MAX' \
443 include $(srcdir)/Makefile.nonreentrant
444 sc_prohibit_nonreentrant
:
445 @prohibit
="\\<(${NON_REENTRANT_RE}) *\\(" \
446 halt
="use re-entrant functions (usually ending with _r)" \
450 @prohibit
='\<select *\(' \
451 halt
='use poll(), not select()' \
454 # Prohibit the inclusion of <ctype.h>.
456 @prohibit
='^# *include *<ctype\.h>' \
457 halt
='use c-ctype.h instead of ctype.h' \
460 # We have our own wrapper for mocking purposes
461 sc_prohibit_canonicalize_file_name
:
462 @prohibit
='\<canonicalize_file_name\(' \
463 exclude
='exempt from syntax-check' \
464 halt
='use virFileCanonicalizePath() instead of canonicalize_file_name()' \
467 # Insist on correct types for [pug]id.
469 @prohibit
='\<(int|long) *[pug]id\>' \
470 exclude
='exempt from syntax-check' \
471 halt
='use pid_t for pid, uid_t for uid, gid_t for gid' \
474 # "const fooPtr a" is the same as "foo * const a", even though it is
475 # usually desired to have "foo const *a". It's easier to just prevent
476 # the confusing mix of typedef vs. const placement.
477 # Also requires that all 'fooPtr' typedefs are actually pointers.
478 sc_forbid_const_pointer_typedef
:
479 @prohibit
='(^|[^"])const \w*Ptr' \
480 halt
='"const fooPtr var" does not declare what you meant' \
482 @prohibit
='typedef [^(]+ [^*]\w*Ptr\b' \
483 halt
='use correct style and type for Ptr typedefs' \
486 # Forbid sizeof foo or sizeof (foo), require sizeof(foo)
488 @prohibit
='sizeof\s' \
489 halt
='use sizeof(foo), not sizeof (foo) or sizeof foo' \
492 # Ensure that no C source file, docs, or rng schema uses TABs for
493 # indentation. Also match *.h.in files, to get libvirt.h.in. Exclude
494 # files in gnulib, since they're imported.
495 space_indent_files
=(\.
(aug
(\.in
)?|rng|s?
[ch
](\.in
)?|html.in|py|pl|syms
)|
(daemon|tools
)/.
*\.in
)
496 sc_TAB_in_indentation
:
498 in_vc_files
='$(space_indent_files)$$' \
499 halt
='indent with space, not TAB, in C, sh, html, py, syms and RNG schemas' \
502 ctype_re
= isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
503 |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
505 sc_avoid_ctype_macros
:
506 @prohibit
='\b($(ctype_re)) *\(' \
507 in_vc_files
='\.[ch]$$' \
508 halt
='use c-ctype.h instead of ctype macros' \
512 @prohibit
='\bstrn?case(cmp|str) *\(' \
513 halt
='use c-strcase.h instead of raw strcase functions' \
516 sc_prohibit_virBufferAdd_with_string_literal
:
517 @prohibit
='\<virBufferAdd *\([^,]+, *"[^"]' \
518 halt
='use virBufferAddLit, not virBufferAdd, with a string literal' \
521 sc_prohibit_virBufferAsprintf_with_string_literal
:
522 @prohibit
='\<virBufferAsprintf *\([^,]+, *"([^%"\]|\\.|%%)*"\)' \
523 halt
='use virBufferAddLit, not virBufferAsprintf, with a string literal' \
526 sc_forbid_manual_xml_indent
:
527 @prohibit
='virBuffer.*" +<' \
528 halt
='use virBufferAdjustIndent instead of spaces when indenting xml' \
531 # dirname and basename from <libgen.h> are not required to be thread-safe
533 @prohibit
='( (base|dir)name *\(|include .libgen\.h)' \
534 halt
='use functions from gnulib "dirname.h", not <libgen.h>' \
537 # raw xmlGetProp requires some nasty casts
538 sc_prohibit_xmlGetProp
:
539 @prohibit
='\<xmlGetProp *\(' \
540 halt
='use virXMLPropString, not xmlGetProp' \
543 # xml(ParseURI|SaveUri) doesn't handle IPv6 URIs well
545 @prohibit
='\<xml(ParseURI|SaveUri) *\(' \
546 halt
='use virURI(Parse|Format), not xml(ParseURI|SaveUri)' \
549 # we don't want old old-style return with parentheses around argument
550 sc_prohibit_return_as_function
:
551 @prohibit
='\<return *\(([^()]*(\([^()]*\)[^()]*)*)\) *;' \
552 halt
='avoid extra () with return statements' \
555 # ATTRIBUTE_UNUSED should only be applied in implementations, not
556 # header declarations
557 sc_avoid_attribute_unused_in_header
:
558 @prohibit
='^[^#]*ATTRIBUTE_UNUSED([^:]|$$)' \
559 in_vc_files
='\.h$$' \
560 halt
='use ATTRIBUTE_UNUSED in .c rather than .h files' \
563 sc_prohibit_int_index
:
564 @prohibit
='\<(int|unsigned)\s*\*?index\>(\s|,|;)' \
565 halt
='use different name than 'index
' for declaration' \
569 @prohibit
='\<(int|unsigned) ([^(=]* )*(i|j|k)\>(\s|,|;)' \
570 exclude
='exempt from syntax-check' \
571 halt
='use size_t, not int/unsigned int for loop vars i, j, k' \
574 sc_prohibit_loop_iijjkk
:
575 @prohibit
='\<(int|unsigned) ([^=]+ )*(ii|jj|kk)\>(\s|,|;)' \
576 halt
='use i, j, k for loop iterators, not ii, jj, kk' \
579 # RHEL 5 gcc can't grok "for (int i..."
580 sc_prohibit_loop_var_decl
:
581 @prohibit
='\<for *\(\w+[ *]+\w+' \
582 in_vc_files
='\.[ch]$$' \
583 halt
='declare loop iterators outside the for statement' \
586 # Use 'bool', not 'int', when assigning true or false
587 sc_prohibit_int_assign_bool
:
588 @prohibit
='\<int\>.*= *(true|false)' \
589 halt
='use bool type for boolean values' \
592 sc_prohibit_unsigned_pid
:
593 @prohibit
='\<unsigned\> [^,=;(]+pid' \
594 halt
='use signed type for pid values' \
597 # Many of the function names below came from this filter:
598 # git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
599 # |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \
600 # |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)$'
603 msg_gen_function
+= VIR_ERROR
604 msg_gen_function
+= lxcError
605 msg_gen_function
+= regerror
606 msg_gen_function
+= vah_error
607 msg_gen_function
+= vah_warning
608 msg_gen_function
+= virGenericReportError
609 msg_gen_function
+= virRaiseError
610 msg_gen_function
+= virReportError
611 msg_gen_function
+= virReportErrorHelper
612 msg_gen_function
+= virReportSystemError
613 msg_gen_function
+= xenapiSessionErrorHandler
614 msg_gen_function
+= virLastErrorPrefixMessage
616 # Uncomment the following and run "make syntax-check" to see diagnostics
617 # that are not yet marked for translation, but that need to be rewritten
618 # so that they are translatable.
619 # msg_gen_function += fprintf
620 # msg_gen_function += testError
621 # msg_gen_function += vshPrint
622 # msg_gen_function += vshError
626 func_re
= ($(subst $(space
),|
,$(msg_gen_function
)))
628 # Look for diagnostics that aren't marked for translation.
629 # This won't find any for which error's format string is on a separate line.
630 # The sed filters eliminate false-positives like these:
632 # "%s", _("no storage vol w..."
633 sc_libvirt_unmarked_diagnostics
:
634 @prohibit
='\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' \
636 halt
='found unmarked diagnostic(s)' \
638 @
{ $(VC_LIST_EXCEPT
) | xargs \
639 $(GREP
) -nE
'\<$(func_re) *\(.*;$$' /dev
/null
; \
640 $(VC_LIST_EXCEPT
) | xargs \
641 $(GREP
) -A1
-nE
'\<$(func_re) *\(.*,$$' /dev
/null
; } \
642 |
$(SED
) -E
's/_\("([^\"]|\\.)+"//;s/"%s"//' \
644 { echo
'$(ME): found unmarked diagnostic(s)' 1>&2; \
647 # Like the above, but prohibit a newline at the end of a diagnostic.
648 # This is subject to false positives partly because it naively looks for
649 # `\n"', which may not be the end of the string, and also because it takes
650 # two lines of context (the -A2) after the line with the function name.
651 # FIXME: this rule might benefit from a separate function list, in case
652 # there are functions to which this one applies but that do not get marked
654 sc_prohibit_newline_at_end_of_diagnostic
:
655 @
$(VC_LIST_EXCEPT
) | xargs
$(GREP
) -A2
-nE \
656 '\<$(func_re) *\(' /dev
/null \
658 && { echo
'$(ME): newline at end of message(s)' 1>&2; \
661 # Look for diagnostics that lack a % in the format string, except that we
662 # allow VIR_ERROR to do this, and ignore functions that take a single
663 # string rather than a format argument.
664 sc_prohibit_diagnostic_without_format
:
665 @
{ $(VC_LIST_EXCEPT
) | xargs \
666 $(GREP
) -nE
'\<$(func_re) *\(.*;$$' /dev
/null
; \
667 $(VC_LIST_EXCEPT
) | xargs \
668 $(GREP
) -A2
-nE
'\<$(func_re) *\(.*,$$' /dev
/null
; } \
669 |
$(SED
) -rn
-e
':l; /[,"]$$/ {N;b l;}' \
670 -e
'/(xenapiSessionErrorHandler|vah_(error|warning))/d' \
671 -e
'/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \
672 |
$(GREP
) -vE
'VIR_ERROR' && \
673 { echo
'$(ME): found diagnostic without %' 1>&2; \
676 # The strings "" and "%s" should never be marked for translation.
677 # Files under tests/ and examples/ should not be translated.
678 sc_prohibit_useless_translation
:
679 @prohibit
='_\("(%s)?"\)' \
680 halt
='found useless translation' \
682 @prohibit
='\<N?_ *\(' \
683 in_vc_files
='(tests|examples)/' \
684 halt
='no translations in tests or examples' \
687 # When splitting a diagnostic across lines, ensure that there is a space
688 # or \n on one side of the split.
689 sc_require_whitespace_in_translation
:
690 @
$(VC_LIST_EXCEPT
) | xargs
$(GREP
) -n
-A1
'"$$' /dev
/null \
691 |
$(SED
) -ne
':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \
692 -e
'/_(.*[^\ ]""[^\ ]/p' |
$(GREP
) .
&& \
693 { echo
'$(ME): missing whitespace at line split' 1>&2; \
696 # Enforce recommended preprocessor indentation style.
697 sc_preprocessor_indentation
:
698 @if cppi
--version
>/dev
/null
2>&1; then \
699 $(VC_LIST_EXCEPT
) |
$(GREP
) -E
'\.[ch](\.in)?$$' | xargs cppi
-a
-c \
700 ||
{ echo
'$(ME): incorrect preprocessor indentation' 1>&2; \
703 echo
'$(ME): skipping test $@: cppi not installed' 1>&2; \
706 # Enforce similar spec file indentation style, by running cppi on a
707 # (comment-only) C file that mirrors the same layout as the spec file.
709 @if cppi
--version
>/dev
/null
2>&1; then \
710 for f in
$$($(VC_LIST_EXCEPT
) |
$(GREP
) '\.spec\.in$$'); do \
711 $(SED
) -e
's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \
712 -e
's/%\(else\|endif\|define\)/#\1/' \
713 -e
's/^\( *\)\1\1\1#/#\1/' \
714 -e
's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \
715 | cppi
-a
-c
2>&1 |
$(SED
) "s|standard input|$$f|"; \
716 done |
{ if
$(GREP
) .
>&2; then false
; else :; fi
; } \
717 ||
{ echo
'$(ME): incorrect preprocessor indentation' 1>&2; \
720 echo
'$(ME): skipping test $@: cppi not installed' 1>&2; \
723 # Nested conditionals are easier to understand if we enforce that endifs
724 # can be paired back to the if
725 sc_makefile_conditionals
:
726 @prohibit
='(else|endif)($$| *#)' \
727 in_vc_files
='Makefile\.am' \
728 halt
='match "if FOO" with "endif FOO" in Makefiles' \
731 # Long lines can be harder to diff; too long, and git send-email chokes.
732 # For now, only enforce line length on files where we have intentionally
733 # fixed things and don't want to regress.
734 sc_prohibit_long_lines
:
736 in_vc_files
='\.arg[sv]' \
737 halt
='Wrap long lines in expected output files' \
740 in_vc_files
='Makefile\.am' \
741 halt
='Wrap long lines in Makefiles' \
745 @require
='Copyright .*Red 'Hat
', Inc\.' \
746 containing
='Copyright .*Red 'Hat \
747 halt
='Red Hat copyright is missing Inc.' \
749 @prohibit
='Copyright [^(].*Red 'Hat \
750 halt
='consistently use (C) in Red Hat copyright' \
752 @prohibit
='\<RedHat\>' \
753 halt
='spell Red Hat as two words' \
756 # Prefer the new URL listing over the old street address listing when
757 # calling out where to get a copy of the [L]GPL. Also, while we have
758 # to ship COPYING (GPL) alongside COPYING.LESSER (LGPL), we want any
759 # source file that calls out a top-level file to call out the LGPL
760 # version. Note that our typical copyright boilerplate refers to the
761 # license by name, not by reference to a top-level file.
763 @prohibit
=Boston
,' MA' \
764 halt
='Point to <http://www.gnu.org/licenses/>, not an address' \
766 @require
='COPYING\.LESSER' \
767 containing
='COPYING' \
768 halt
='Refer to COPYING.LESSER for LGPL' \
770 @prohibit
='COPYING\.LIB' \
771 halt
='Refer to COPYING.LESSER for LGPL' \
774 # Some functions/macros produce messages intended solely for developers
775 # and maintainers. Do not mark them for translation.
776 sc_prohibit_gettext_markup
:
777 @prohibit
='\<VIR_(WARN|INFO|DEBUG) *\(_\(' \
778 halt
='do not mark these strings for translation' \
781 # Our code is divided into modular subdirectories for a reason, and
782 # lower-level code must not include higher-level headers.
783 cross_dirs
=$(patsubst $(srcdir)/src
/%.
,%,$(wildcard $(srcdir)/src
/*/.
))
784 cross_dirs_re
=($(subst / ,/|
,$(cross_dirs
)))
785 mid_dirs
=access|admin|conf|cpu|locking|logging|rpc|security
786 sc_prohibit_cross_inclusion
:
787 @for
dir in
$(cross_dirs
); do \
789 util
/) safe
="util";; \
790 access
/ | conf
/) safe
="($$dir|conf|util)";; \
791 cpu
/| network
/| node_device
/| rpc
/| security
/| storage
/) \
792 safe
="($$dir|util|conf|storage)";; \
793 xenapi
/ | xenconfig
/ ) safe
="($$dir|util|conf|xen|cpu)";; \
794 *) safe
="($$dir|$(mid_dirs)|util)";; \
796 in_vc_files
="^src/$$dir" \
797 prohibit
='^# *include .$(cross_dirs_re)' \
798 exclude
="# *include .$$safe" \
799 halt
='unsafe cross-directory include' \
800 $(_sc_search_regexp
) \
803 # When converting an enum to a string, make sure that we track any new
804 # elements added to the enum by using a _LAST marker.
805 sc_require_enum_last_marker
:
806 @
$(VC_LIST_EXCEPT
) | xargs \
807 $(GREP
) -A1
-nE
'^[^#]*VIR_ENUM_IMPL *\(' /dev
/null \
808 |
$(SED
) -ne
'/VIR_ENUM_IMPL.*,$$/N' \
809 -e
'/VIR_ENUM_IMPL[^,]*,[^,]*,[^,]*[^_,][^L,][^A,][^S,][^T,],/p' \
810 -e
'/VIR_ENUM_IMPL[^,]*,[^,]\{0,4\},/p' \
812 { echo
'$(ME): enum impl needs _LAST marker on second line' 1>&2; \
815 # In Python files we don't want to end lines with a semicolon like in C
816 sc_prohibit_semicolon_at_eol_in_python
:
817 @prohibit
='^[^#].*\;$$' \
818 in_vc_files
='\.py$$' \
819 halt
='python does not require to end lines with a semicolon' \
822 # mymain() in test files should use return, not exit, for nicer output
823 sc_prohibit_exit_in_tests
:
824 @prohibit
='\<exit *\(' \
825 in_vc_files
='tests/.*\.c$$' \
826 halt
='use return, not exit(), in tests' \
829 # Don't include "libvirt/*.h" in "" form.
830 sc_prohibit_include_public_headers_quote
:
831 @prohibit
='# *include *"libvirt/.*\.h"' \
832 in_vc_files
='\.[ch]$$' \
833 halt
='Do not include libvirt/*.h in internal source' \
836 # Don't include "libvirt/*.h" in <> form. Except for external tools,
837 # e.g. Python binding, examples and tools subdirectories.
838 sc_prohibit_include_public_headers_brackets
:
839 @prohibit
='# *include *<libvirt/.*\.h>' \
840 in_vc_files
='\.[ch]$$' \
841 halt
='Do not include libvirt/*.h in internal source' \
844 # <config.h> is only needed in .c files; .h files do not need it since
845 # .c files must include config.h before any other .h.
846 sc_prohibit_config_h_in_headers
:
847 @prohibit
='^# *include\>.*config\.h' \
848 in_vc_files
='\.h$$' \
849 halt
='headers should not include <config.h>' \
852 sc_prohibit_unbounded_arrays_in_rpc
:
854 in_vc_files
='\.x$$' \
855 halt
='Arrays in XDR must have a upper limit set for <NNN>' \
859 @prohibit
='\b(secure_)?getenv *\(' \
860 exclude
='exempt from syntax-check' \
861 halt
='Use virGetEnv{Allow,Block}SUID instead of getenv' \
865 @prohibit
='\bato(i|f|l|ll|q) *\(' \
866 halt
='Use virStrToLong* instead of atoi, atol, atof, atoq, atoll' \
869 sc_prohibit_wrong_filename_in_comment
:
870 @
$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[ch]$$' | xargs awk
'BEGIN { \
873 n=match($$0, /[[:space:]][^[:space:]]*[.][ch][[:space:]:]/); \
875 A=substr($$0, RSTART+1, RLENGTH-2); \
876 n=split(FILENAME, arr, "/"); \
878 print "in " FILENAME ": " A " mentioned in comments "; \
886 }' ||
{ echo
'$(ME): The file name in comments must match the' \
887 'actual file name' 1>&2; exit
1; }
889 sc_prohibit_virConnectOpen_in_virsh
:
890 @prohibit
='\bvirConnectOpen[a-zA-Z]* *\(' \
891 in_vc_files
='tools/virsh-.*\.[ch]$$' \
892 halt
='Use vshConnect() in virsh instead of virConnectOpen*' \
895 sc_require_space_before_label
:
896 @prohibit
='^( ?)?[_a-zA-Z0-9]+:$$' \
897 in_vc_files
='\.[ch]$$' \
898 halt
='Top-level labels should be indented by one space' \
901 # Allow for up to three spaces before the label: this is to avoid running
902 # into situations where neither this rule nor require_space_before_label
903 # would apply, eg. a line matching ^[a-zA-Z0-9]+ :$
904 sc_prohibit_space_in_label
:
905 @prohibit
='^ {0,3}[_a-zA-Z0-9]+ +:$$' \
906 in_vc_files
='\.[ch]$$' \
907 halt
='There should be no space between label name and colon' \
910 # Doesn't catch all cases of mismatched braces across if-else, but it helps
911 sc_require_if_else_matching_braces
:
912 @prohibit
='( else( if .*\))? {|} else( if .*\))?$$)' \
913 in_vc_files
='\.[chx]$$' \
914 halt
='if one side of if-else uses {}, both sides must use it' \
917 sc_curly_braces_style
:
918 @if
$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[ch]$$' | xargs
$(GREP
) -nHP \
919 '^\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)\) ?\{' \
921 echo
'$(ME): Non-K&R style used for curly braces around' \
922 'function body' 1>&2; exit
1; \
924 if
$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[ch]$$' | xargs \
925 $(GREP
) -A1
-En
' ((if|for|while|switch) \(|(else|do)\b)[^{]*$$' \
926 /dev
/null |
$(GREP
) '^[^ ]*- *{'; then \
927 echo
'$(ME): Use hanging braces for compound statements' 1>&2; exit
1; \
930 sc_prohibit_windows_special_chars_in_filename
:
931 @
$(VC_LIST_EXCEPT
) |
$(GREP
) '[:*?"<>|]' && \
932 { echo
'$(ME): Windows special chars in filename not allowed' 1>&2; echo exit
1; } ||
:
934 sc_prohibit_mixed_case_abbreviations
:
935 @prohibit
='Pci|Usb|Scsi' \
936 in_vc_files
='\.[ch]$$' \
937 halt
='Use PCI, USB, SCSI, not Pci, Usb, Scsi' \
940 # Require #include <locale.h> in all files that call setlocale()
942 @require
='include.*locale\.h' \
943 containing
='setlocale *(' \
944 halt
='setlocale() requires <locale.h>' \
947 sc_prohibit_empty_first_line
:
948 @
$(VC_LIST_EXCEPT
) | xargs awk
'BEGIN { fail=0; } \
949 FNR == 1 { if ($$0 == "") { print FILENAME ":1:"; fail=1; } } \
950 END { if (fail == 1) { \
951 print "$(ME): Prohibited empty first line" > "/dev/stderr"; \
954 sc_prohibit_paren_brace
:
956 in_vc_files
='\.[chx]$$' \
957 halt
='Put space between closing parenthesis and opening brace' \
960 # C guarantees that static variables are zero initialized, and some compilers
961 # waste space by sticking explicit initializers in .data instead of .bss
962 sc_prohibit_static_zero_init
:
963 @prohibit
='\bstatic\b.*= *(0[^xX0-9]|NULL|false)' \
964 in_vc_files
='\.[chx](\.in)?$$' \
965 halt
='static variables do not need explicit zero initialization'\
968 # FreeBSD exports the "devname" symbol which produces a warning.
970 @prohibit
='\bdevname\b' \
971 exclude
='sc_prohibit_devname' \
972 halt
='avoid using devname as FreeBSD exports the symbol' \
975 sc_prohibit_system_error_with_vir_err
:
976 @prohibit
='\bvirReportSystemError *\(VIR_ERR_' \
977 halt
='do not use virReportSystemError with VIR_ERR_* error codes' \
980 # Rule to prohibit usage of virXXXFree within library, daemon, remote, etc.
981 # functions. There's a corresponding exclude to allow usage within tests,
982 # docs, examples, tools, src/libvirt-*.c, and include/libvirt/libvirt-*.h
983 sc_prohibit_virXXXFree
:
984 @prohibit
='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter|Interface|DomainSnapshot)Free\b' \
985 exclude
='sc_prohibit_virXXXFree' \
986 halt
='avoid using virXXXFree, use virObjectUnref instead' \
989 sc_prohibit_sysconf_pagesize
:
990 @prohibit
='sysconf\(_SC_PAGESIZE' \
991 halt
='use virGetSystemPageSize[KB] instead of sysconf(_SC_PAGESIZE)' \
994 sc_prohibit_virSecurity
:
995 @
$(VC_LIST_EXCEPT
) |
$(GREP
) 'src/qemu/' | \
996 $(GREP
) -v
'src/qemu/qemu_security' | \
997 xargs
$(GREP
) -Pn
'virSecurityManager(?!Ptr)' /dev
/null
&& \
998 { echo
'$(ME): prefer qemuSecurity wrappers' 1>&2; exit
1; } ||
:
1000 sc_prohibit_pthread_create
:
1001 @prohibit
='\bpthread_create\b' \
1002 exclude
='sc_prohibit_pthread_create' \
1003 halt
='avoid using pthread_create, use virThreadCreate instead' \
1004 $(_sc_search_regexp
)
1006 sc_prohibit_not_streq
:
1007 @prohibit
='! *STRN?EQ *\(.*\)' \
1008 halt
='Use STRNEQ instead of !STREQ and STREQ instead of !STRNEQ' \
1009 $(_sc_search_regexp
)
1011 sc_prohibit_verbose_strcat
:
1012 @prohibit
='strncat\([^,]*,\s+([^,]*),\s+strlen\(\1\)\)' \
1013 in_vc_files
='\.[ch]$$' \
1014 halt
='Use strcat(a, b) instead of strncat(a, b, strlen(b))' \
1015 $(_sc_search_regexp
)
1017 # Ensure that each .c file containing a "main" function also
1018 # calls virGettextInitialize
1020 @require
='virGettextInitialize *\(' \
1021 in_vc_files
='\.c$$' \
1022 containing
='\<main *(' \
1023 halt
='the above files do not call virGettextInitialize' \
1024 $(_sc_search_regexp
)
1026 sc_prohibit_obj_free_apis_in_virsh
:
1027 @prohibit
='\bvir(Domain|DomainSnapshot)Free\b' \
1028 in_vc_files
='virsh.*\.[ch]$$' \
1029 exclude
='sc_prohibit_obj_free_apis_in_virsh' \
1030 halt
='avoid using virDomain(Snapshot)Free in virsh, use virsh-prefixed wrappers instead' \
1031 $(_sc_search_regexp
)
1033 https_sites
= www.libvirt.org
1034 https_sites
+= libvirt.org
1035 https_sites
+= security.libvirt.org
1036 https_sites
+= qemu.org
1037 https_sites
+= www.qemu.org
1038 https_sites
+= wiki.qemu.org
1039 https_sites
+= linux-kvm.org
1040 https_sites
+= www.linux-kvm.org
1042 https_re
= ($(subst $(space
),|
,$(https_sites
)))
1044 sc_prohibit_http_urls
:
1045 @prohibit
='http://$(https_re)' \
1046 exclude
="/schemas/" \
1047 halt
='Links must use https:// protocol' \
1048 $(_sc_search_regexp
)
1051 @prohibit
="(\*|#)\s*(A|a)uthors?:" \
1052 halt
="Author: statements are prohibited in source comments" \
1053 $(_sc_search_regexp
)
1055 # Alignment is usually achieved through spaces (at least two of them)
1056 # or tabs (at least one of them) right before the trailing backslash
1057 sc_prohibit_backslash_alignment
:
1058 @prohibit
='( | )\\$$' \
1059 in_vc_files
='*\.([chx]|am|mk)$$' \
1060 halt
='Do not attempt to right-align backslashes' \
1061 $(_sc_search_regexp
)
1063 # Some syntax rules pertaining to the usage of cleanup macros
1064 # implementing GNU C's cleanup attribute
1066 # Rule to ensure that variables declared using a cleanup macro are
1067 # always initialized.
1068 sc_require_attribute_cleanup_initialization
:
1069 @prohibit
='VIR_AUTO((FREE|PTR|UNREF|CLEAN)\(.+\)|CLOSE|STRINGLIST) *[^=]+;' \
1070 in_vc_files
='\.[chx]$$' \
1071 halt
='variable declared with a cleanup macro must be initialized' \
1072 $(_sc_search_regexp
)
1074 # "class" in headers is not good because by default Vim treats it as a keyword
1075 # Let's prohibit it in source files as well.
1077 @prohibit
=' +_?class *;' \
1078 in_vc_files
='\.[chx]$$' \
1079 halt
='use klass instead of class or _class' \
1080 $(_sc_search_regexp
)
1082 # The dirent "d_type" field is non-portable and even when it
1083 # exists some filesystems will only ever return DT_UNKNOWN.
1084 # This field should only be used by code which is exclusively
1085 # run platforms supporting "d_type" and must expect DT_UNKNOWN.
1086 # We blacklist it to discourage accidental usage which has
1087 # happened many times. Add an exclude rule if it is genuinely
1088 # needed and the above restrictions are acceptable.
1089 sc_prohibit_dirent_d_type
:
1090 @prohibit
='(->|\.)d_type' \
1091 in_vc_files
='\.[chx]$$' \
1092 halt
='do not use the d_type field in "struct dirent"' \
1093 $(_sc_search_regexp
)
1096 # We don't use this feature of maint.mk.
1097 prev_version_file
= /dev
/null
1099 ifneq ($(_gl-Makefile
),)
1100 ifeq (0,$(MAKELEVEL
))
1101 _dry_run_result
:= $(shell \
1103 test -d .git ||
test -f .git ||
{ echo
0; exit
; }; \
1104 $(srcdir)/autogen.sh
--dry-run
>/dev
/null
2>&1; \
1107 _clean_requested
= $(filter %clean,$(MAKECMDGOALS
))
1109 # A return value of 0 means no action is required
1111 # A return value of 1 means a genuine error has occurred while
1112 # performing the dry run, and it should be reported so it can
1114 ifeq (1,$(_dry_run_result
))
1115 $(info INFO
: autogen.sh error
, running again to show details
)
1116 maint.mk Makefile
: _autogen_error
1119 # A return value of 2 means that autogen.sh needs to be executed
1120 # in earnest before building, probably because of gnulib updates.
1121 # We don't run autogen.sh if the clean target has been invoked,
1122 # though, as it would be quite pointless
1123 ifeq (2,$(_dry_run_result
)$(_clean_requested
))
1124 $(info INFO
: running autogen.sh is required
, running it now...
)
1125 $(shell touch
$(srcdir)/AUTHORS
)
1126 maint.mk Makefile
: _autogen
1131 # It is necessary to call autogen any time gnulib changes. Autogen
1132 # reruns configure, then we regenerate all Makefiles at once.
1135 $(srcdir)/autogen.sh
1138 .PHONY
: _autogen_error
1140 $(srcdir)/autogen.sh
--dry-run
1142 ifneq ($(_gl-Makefile
),)
1143 syntax-check
: spacing-check test-wrap-argv \
1144 prohibit-duplicate-header mock-noinline group-qemu-caps \
1146 @if
! cppi
--version
>/dev
/null
2>&1; then \
1147 echo
"*****************************************************" >&2; \
1148 echo
"* cppi not installed, some checks have been skipped *" >&2; \
1149 echo
"*****************************************************" >&2; \
1153 # Don't include duplicate header in the source (either *.c or *.h)
1154 prohibit-duplicate-header
:
1155 $(AM_V_GEN
)$(VC_LIST_EXCEPT
) |
$(GREP
) '\.[chx]$$' | xargs \
1156 $(PERL
) -W
$(top_srcdir
)/build-aux
/prohibit-duplicate-header.pl
1159 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) '\.c$$' | xargs \
1160 $(PERL
) $(top_srcdir
)/build-aux
/check-spacing.pl || \
1161 { echo
'$(ME): incorrect formatting' 1>&2; exit
1; }
1164 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) '\.[ch]$$' | xargs \
1165 $(PERL
) $(top_srcdir
)/build-aux
/mock-noinline.pl
1168 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) '\.[h]$$' | xargs \
1169 $(PERL
) $(top_srcdir
)/build-aux
/header-ifdef.pl
1172 $(AM_V_GEN
)$(VC_LIST
) |
$(GREP
) -E
'\.(ldargs|args)' | xargs \
1173 $(PERL
) $(top_srcdir
)/tests
/test-wrap-argv.pl
--check
1176 $(AM_V_GEN
)$(PERL
) $(top_srcdir
)/tests
/group-qemu-caps.pl
--check $(top_srcdir
)/
1178 # sc_po_check can fail if generated files are not built first
1180 $(srcdir)/src
/remote
/remote_daemon_dispatch_stubs.h \
1181 $(srcdir)/src
/remote
/remote_daemon_dispatch_qemu_stubs.h \
1182 $(srcdir)/src
/remote
/remote_client_bodies.h \
1183 $(srcdir)/src
/admin
/admin_server_dispatch_stubs.h \
1184 $(srcdir)/src
/admin
/admin_client.h
1185 $(srcdir)/src
/remote
/remote_daemon_dispatch_stubs.h
: $(srcdir)/src
/remote
/remote_protocol.x
1186 $(MAKE
) -C src remote
/remote_daemon_dispatch_stubs.h
1187 $(srcdir)/src
/remote
/remote_daemon_dispatch_qemu_stubs.h
: $(srcdir)/src
/remote
/qemu_protocol.x
1188 $(MAKE
) -C src remote
/remote_daemon_dispatch_qemu_stubs.h
1189 $(srcdir)/src
/remote
/remote_client_bodies.h
: $(srcdir)/src
/remote
/remote_protocol.x
1190 $(MAKE
) -C src remote
/remote_client_bodies.h
1191 $(srcdir)/src
/admin
/admin_server_dispatch_stubs.h
: $(srcdir)/src
/admin
/admin_protocol.x
1192 $(MAKE
) -C src admin
/admin_server_dispatch_stubs.h
1193 $(srcdir)/src
/admin
/admin_client.h
: $(srcdir)/src
/admin
/admin_protocol.x
1194 $(MAKE
) -C src admin
/admin_client.h
1196 # List all syntax-check exemptions:
1197 exclude_file_name_regexp--sc_avoid_strcase
= ^tools
/vsh\.h
$$
1199 _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
1200 _test1
=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock|commandhelper
1201 exclude_file_name_regexp--sc_avoid_write
= \
1202 ^
(src
/($(_src1
))|tools
/virsh-console|tests
/($(_test1
)))\.c
$$
1204 exclude_file_name_regexp--sc_bindtextdomain
= .
*
1206 exclude_file_name_regexp--sc_gettext_init
= ^
(tests|examples
)/
1208 exclude_file_name_regexp--sc_copyright_format
= \
1211 exclude_file_name_regexp--sc_copyright_usage
= \
1212 ^COPYING
(|\.LESSER
)$$
1214 exclude_file_name_regexp--sc_flags_usage
= \
1215 ^
(cfg\.mk|docs
/|src
/util
/virnetdevtap\.c
$$|tests
/((vir
(cgroup|pci|
test|usb
)|nss|qemuxml2argv|qemusecurity
)mock|virfilewrapper
)\.c
$$)
1217 exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics
= \
1218 ^
(src
/rpc
/gendispatch\.pl
$$|tests
/)
1220 exclude_file_name_regexp--sc_po_check
= ^
(docs
/|src
/rpc
/gendispatch\.pl
$$)
1222 exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY
= \
1223 ^
(cfg\.mk|
include/libvirt
/virterror\.h|src
/remote
/remote_daemon_dispatch\.c|src
/util
/virerror\.c|docs
/internals
/oomtesting\.html\.in
)$$
1225 exclude_file_name_regexp--sc_prohibit_PATH_MAX
= \
1228 exclude_file_name_regexp--sc_prohibit_access_xok
= \
1229 ^
(cfg\.mk|src
/util
/virutil\.c
)$$
1231 exclude_file_name_regexp--sc_prohibit_asprintf
= \
1232 ^
(cfg\.mk|bootstrap.conf
$$|examples
/|src
/util
/virstring\.
[ch
]$$|tests
/vircgroupmock\.c
$$)
1234 exclude_file_name_regexp--sc_prohibit_strdup
= \
1235 ^
(docs
/|examples
/|src
/util
/virstring\.c|tests
/vir
(netserverclient|cgroup
)mock.c|tests
/commandhelper\.c
$$)
1237 exclude_file_name_regexp--sc_prohibit_close
= \
1238 (\.p
[yl
]$$|\.spec\.in
$$|^docs
/|^
(src
/util
/virfile\.c|src
/libvirt-stream\.c|tests
/(vir.
+mock\.c|commandhelper\.c|qemusecuritymock\.c
))$$)
1240 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF
= \
1241 (^tests
/(virhostcpu|virpcitest
)data
/|docs
/js
/.
*\.js|docs
/fonts
/.
*\.woff|\.diff|tests
/virconfdata
/no-newline\.conf
$$)
1243 _src2
=src
/(util
/vircommand|libvirt|lxc
/lxc_controller|locking
/lock_daemon|logging
/log_daemon|remote
/remote_daemon
)
1244 exclude_file_name_regexp--sc_prohibit_fork_wrappers
= \
1245 (^
($(_src2
)|tests
/testutils
)\.c
$$)
1247 exclude_file_name_regexp--sc_prohibit_gethostname
= ^src
/util
/vir
(util|log
)\.c
$$
1249 exclude_file_name_regexp--sc_prohibit_internal_functions
= \
1250 ^src
/(util
/(viralloc|virutil|virfile
)\.
[hc
]|esx
/esx_vi\.c
)$$
1252 exclude_file_name_regexp--sc_prohibit_raw_virclassnew
= \
1253 ^src
/util
/virobject\.
[hc
]$$
1255 exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic
= \
1256 ^src
/rpc
/gendispatch\.pl
$$
1258 exclude_file_name_regexp--sc_prohibit_nonreentrant
= \
1259 ^
((po|tests|examples
)/|docs
/.
*(py|js|html\.in
)|run.in
$$|tools
/wireshark
/util
/genxdrstub\.pl
$$)
1261 exclude_file_name_regexp--sc_prohibit_select
= \
1264 exclude_file_name_regexp--sc_prohibit_canonicalize_file_name
= \
1265 ^
(cfg\.mk|tests
/virfilemock\.c
)$$
1267 exclude_file_name_regexp--sc_prohibit_raw_allocation
= \
1268 ^
(docs
/hacking\.html\.in|src
/util
/viralloc\.
[ch
]|examples
/.
*|tests
/(securityselinuxhelper|
(vircgroup|nss
)mock|commandhelper
)\.c|tools
/wireshark
/src
/packet-libvirt\.c
)$$
1270 exclude_file_name_regexp--sc_prohibit_readlink
= \
1271 ^src
/(util
/virutil|lxc
/lxc_container
)\.c
$$
1273 exclude_file_name_regexp--sc_prohibit_setuid
= ^src
/util
/virutil\.c
$$
1275 exclude_file_name_regexp--sc_prohibit_sprintf
= \
1276 ^
(cfg\.mk|docs
/hacking\.html\.in|.
*\.stp|.
*\.pl
)$$
1278 exclude_file_name_regexp--sc_prohibit_strncpy
= ^src
/util
/virstring\.c
$$
1280 exclude_file_name_regexp--sc_prohibit_strtol
= ^examples
/.
*$$
1282 exclude_file_name_regexp--sc_prohibit_xmlGetProp
= ^src
/util
/virxml\.c
$$
1284 exclude_file_name_regexp--sc_prohibit_xmlURI
= ^src
/util
/viruri\.c
$$
1286 exclude_file_name_regexp--sc_prohibit_return_as_function
= \.py
$$
1288 exclude_file_name_regexp--sc_require_config_h
= \
1289 ^
(examples
/|tools
/virsh-edit\.c
$$|tests
/virmockstathelpers.c
)
1291 exclude_file_name_regexp--sc_require_config_h_first
= \
1292 ^
(examples
/|tools
/virsh-edit\.c
$$|tests
/virmockstathelpers.c
)
1294 exclude_file_name_regexp--sc_trailing_blank
= \
1295 /sysinfodata
/.
*\.data|
/virhostcpudata
/.
*\.cpuinfo|^gnulib
/local
/.
*/.
*diff
$$
1297 exclude_file_name_regexp--sc_unmarked_diagnostics
= \
1298 ^
(docs
/apibuild.py|tests
/virt-aa-helper-test|docs
/js
/.
*\.js
)$$
1300 exclude_file_name_regexp--sc_size_of_brackets
= cfg.mk
1302 exclude_file_name_regexp--sc_correct_id_types
= \
1303 (^src
/locking
/lock_protocol.x
$$)
1305 exclude_file_name_regexp--sc_m4_quote_check
= m4
/virt-lib.m4
1307 exclude_file_name_regexp--sc_prohibit_include_public_headers_quote
= \
1308 ^
(src
/internal\.h
$$|tools
/wireshark
/src
/packet-libvirt.c
$$)
1310 exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets
= \
1311 ^
(tools
/|examples
/|
include/libvirt
/(virterror|libvirt
(-(admin|qemu|lxc
))?
)\.h
$$)
1313 exclude_file_name_regexp--sc_prohibit_int_ijk
= \
1314 ^
(src
/remote_protocol-structs|src
/remote
/remote_protocol\.x|cfg\.mk|
include/libvirt
/libvirt.
+|src
/admin_protocol-structs|src
/admin
/admin_protocol\.x
)$$
1316 exclude_file_name_regexp--sc_prohibit_unsigned_pid
= \
1317 ^
(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
)$$
1319 exclude_file_name_regexp--sc_prohibit_getenv
= \
1322 exclude_file_name_regexp--sc_avoid_attribute_unused_in_header
= \
1323 ^
(src
/util
/virlog\.h|src
/network
/bridge_driver\.h
)$$
1325 exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations
= \
1326 ^src
/(vbox
/vbox_CAPI.
*.h|esx
/esx_vi.
(c|h
)|esx
/esx_storage_backend_iscsi.c
)$$
1328 exclude_file_name_regexp--sc_prohibit_empty_first_line
= \
1329 ^
(README|src
/esx
/README|tests
/(vmwarever|virhostcpu
)data
/.
*)$$
1331 exclude_file_name_regexp--sc_prohibit_useless_translation
= \
1332 ^tests
/virpolkittest.c
1334 exclude_file_name_regexp--sc_prohibit_devname
= \
1335 ^
(tools
/virsh.pod|cfg.mk|docs
/.
*)$$
1337 exclude_file_name_regexp--sc_prohibit_virXXXFree
= \
1338 ^
(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
$$)
1340 exclude_file_name_regexp--sc_prohibit_sysconf_pagesize
= \
1341 ^
(cfg\.mk|src
/util
/virutil\.c
)$$
1343 exclude_file_name_regexp--sc_prohibit_pthread_create
= \
1344 ^
(cfg\.mk|src
/util
/virthread\.c|tests
/.
*)$$
1346 exclude_file_name_regexp--sc_prohibit_always-defined_macros
= \
1347 ^tests
/virtestmock.c
$$
1349 exclude_file_name_regexp--sc_prohibit_readdir
= \
1350 ^tests
/(.
*mock|virfilewrapper
)\.c
$$
1352 exclude_file_name_regexp--sc_prohibit_cross_inclusion
= \
1353 ^
(src
/util
/virclosecallbacks\.h|src
/util
/virhostdev\.h
)$$
1355 exclude_file_name_regexp--sc_prohibit_dirent_d_type
= \
1356 ^
(src
/util
/vircgroup.c
)$