Imported Upstream version 1.2.4
[archive/platform/upstream/libvirt.git] / cfg.mk
1 # Customize Makefile.maint.                           -*- makefile -*-
2 # Copyright (C) 2008-2014 Red Hat, Inc.
3 # Copyright (C) 2003-2008 Free Software Foundation, Inc.
4
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.
9
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.
14
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/>.
18
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))
25
26 url_dir_list = \
27   ftp://$(gnu_rel_host)/gnu/coreutils
28
29 # We use .gnulib, not gnulib.
30 gnulib_dir = $(srcdir)/.gnulib
31
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.
34 generated_files = \
35   $(srcdir)/daemon/*_dispatch.h \
36   $(srcdir)/src/*/*_dispatch.h \
37   $(srcdir)/src/remote/*_client_bodies.h \
38   $(srcdir)/src/*/*_protocol.[ch] \
39   $(srcdir)/gnulib/lib/*.[ch]
40
41 # We haven't converted all scripts to using gnulib's init.sh yet.
42 _test_script_regex = \<\(init\|test-lib\)\.sh\>
43
44 # Tests not to run as part of "make distcheck".
45 local-checks-to-skip =                  \
46   changelog-check                       \
47   makefile-check                        \
48   makefile_path_separator_check         \
49   patch-check                           \
50   sc_GPL_version                        \
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                 \
56   sc_file_system                        \
57   sc_immutable_NEWS                     \
58   sc_makefile_path_separator_check      \
59   sc_obsolete_symbols                   \
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_root_tests                         \
68   sc_space_tab                          \
69   sc_sun_os_names                       \
70   sc_system_h_headers                   \
71   sc_texinfo_acronym                    \
72   sc_tight_scope                        \
73   sc_two_space_separator_in_usage       \
74   sc_error_message_uppercase            \
75   sc_program_name                       \
76   sc_require_test_exit_idiom            \
77   sc_makefile_check                     \
78   sc_useless_cpp_parens
79
80 # Most developers don't run 'make distcheck'.  We want the official
81 # dist to be secure, but don't want to penalize other developers
82 # using a distro that has not yet picked up the automake fix.
83 # FIXME remove this ifeq (making the syntax check unconditional)
84 # once fixed automake (1.11.6 or 1.12.2+) is more common.
85 ifeq ($(filter dist%, $(MAKECMDGOALS)), )
86 local-checks-to-skip += sc_vulnerable_makefile_CVE-2012-3386
87 else
88 distdir: sc_vulnerable_makefile_CVE-2012-3386.z
89 endif
90
91 # Files that should never cause syntax check failures.
92 VC_LIST_ALWAYS_EXCLUDE_REGEX = \
93   (^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$
94
95 # Functions like free() that are no-ops on NULL arguments.
96 useless_free_options =                          \
97   --name=VBOX_UTF16_FREE                        \
98   --name=VBOX_UTF8_FREE                         \
99   --name=VBOX_COM_UNALLOC_MEM                   \
100   --name=VIR_FREE                               \
101   --name=qemuCapsFree                           \
102   --name=qemuMigrationCookieFree                \
103   --name=qemuMigrationCookieGraphicsFree        \
104   --name=sexpr_free                             \
105   --name=usbFreeDevice                          \
106   --name=virBandwidthDefFree                    \
107   --name=virBitmapFree                          \
108   --name=virCPUDefFree                          \
109   --name=virCapabilitiesFree                    \
110   --name=virCapabilitiesFreeGuest               \
111   --name=virCapabilitiesFreeGuestDomain         \
112   --name=virCapabilitiesFreeGuestFeature        \
113   --name=virCapabilitiesFreeGuestMachine        \
114   --name=virCapabilitiesFreeHostNUMACell        \
115   --name=virCapabilitiesFreeMachines            \
116   --name=virCgroupFree                          \
117   --name=virCommandFree                         \
118   --name=virConfFreeList                        \
119   --name=virConfFreeValue                       \
120   --name=virDomainActualNetDefFree              \
121   --name=virDomainChrDefFree                    \
122   --name=virDomainChrSourceDefFree              \
123   --name=virDomainControllerDefFree             \
124   --name=virDomainDefFree                       \
125   --name=virDomainDeviceDefFree                 \
126   --name=virDomainDiskDefFree                   \
127   --name=virDomainEventCallbackListFree         \
128   --name=virObjectEventQueueFree                \
129   --name=virObjectEventStateFree                \
130   --name=virDomainFSDefFree                     \
131   --name=virDomainGraphicsDefFree               \
132   --name=virDomainHostdevDefFree                \
133   --name=virDomainInputDefFree                  \
134   --name=virDomainNetDefFree                    \
135   --name=virDomainObjFree                       \
136   --name=virDomainSmartcardDefFree              \
137   --name=virDomainSnapshotDefFree               \
138   --name=virDomainSnapshotObjFree               \
139   --name=virDomainSoundDefFree                  \
140   --name=virDomainVideoDefFree                  \
141   --name=virDomainWatchdogDefFree               \
142   --name=virFileDirectFdFree                    \
143   --name=virHashFree                            \
144   --name=virInterfaceDefFree                    \
145   --name=virInterfaceIpDefFree                  \
146   --name=virInterfaceObjFree                    \
147   --name=virInterfaceProtocolDefFree            \
148   --name=virJSONValueFree                       \
149   --name=virLastErrFreeData                     \
150   --name=virNetMessageFree                      \
151   --name=virNetServerMDNSFree                   \
152   --name=virNetServerMDNSEntryFree              \
153   --name=virNetServerMDNSGroupFree              \
154   --name=virNWFilterDefFree                     \
155   --name=virNWFilterEntryFree                   \
156   --name=virNWFilterHashTableFree               \
157   --name=virNWFilterIPAddrLearnReqFree          \
158   --name=virNWFilterIncludeDefFree              \
159   --name=virNWFilterObjFree                     \
160   --name=virNWFilterRuleDefFree                 \
161   --name=virNWFilterRuleInstFree                \
162   --name=virNetworkDefFree                      \
163   --name=virNetworkObjFree                      \
164   --name=virNodeDeviceDefFree                   \
165   --name=virNodeDeviceObjFree                   \
166   --name=virObjectUnref                         \
167   --name=virObjectFreeCallback                  \
168   --name=virPCIDeviceFree                       \
169   --name=virSecretDefFree                       \
170   --name=virStorageEncryptionFree               \
171   --name=virStorageEncryptionSecretFree         \
172   --name=virStorageFileFreeMetadata             \
173   --name=virStoragePoolDefFree                  \
174   --name=virStoragePoolObjFree                  \
175   --name=virStoragePoolSourceFree               \
176   --name=virStorageVolDefFree                   \
177   --name=virThreadPoolFree                      \
178   --name=xmlBufferFree                          \
179   --name=xmlFree                                \
180   --name=xmlFreeDoc                             \
181   --name=xmlFreeNode                            \
182   --name=xmlXPathFreeContext                    \
183   --name=xmlXPathFreeObject
184
185 # The following template was generated by this command:
186 # make ID && aid free|grep '^vi'|sed 's/ .*//;s/^/#   /'
187 # N virBufferFreeAndReset
188 # y virCPUDefFree
189 # y virCapabilitiesFree
190 # y virCapabilitiesFreeGuest
191 # y virCapabilitiesFreeGuestDomain
192 # y virCapabilitiesFreeGuestFeature
193 # y virCapabilitiesFreeGuestMachine
194 # y virCapabilitiesFreeHostNUMACell
195 # y virCapabilitiesFreeMachines
196 # N virCapabilitiesFreeNUMAInfo FIXME
197 # y virCgroupFree
198 # N virConfFree               (diagnoses the "error")
199 # y virConfFreeList
200 # y virConfFreeValue
201 # y virDomainChrDefFree
202 # y virDomainControllerDefFree
203 # y virDomainDefFree
204 # y virDomainDeviceDefFree
205 # y virDomainDiskDefFree
206 # y virDomainEventCallbackListFree
207 # y virDomainEventQueueFree
208 # y virDomainFSDefFree
209 # n virDomainFree
210 # n virDomainFreeName (can't fix -- returns int)
211 # y virDomainGraphicsDefFree
212 # y virDomainHostdevDefFree
213 # y virDomainInputDefFree
214 # y virDomainNetDefFree
215 # y virDomainObjFree
216 # y virDomainSnapshotDefFree
217 # n virDomainSnapshotFree (returns int)
218 # n virDomainSnapshotFreeName (returns int)
219 # y virDomainSnapshotObjFree
220 # y virDomainSoundDefFree
221 # y virDomainVideoDefFree
222 # y virDomainWatchdogDefFree
223 # n virDrvNodeGetCellsFreeMemory (returns int)
224 # n virDrvNodeGetFreeMemory (returns long long)
225 # n virFree - dereferences param
226 # n virFreeError
227 # n virHashFree (takes 2 args)
228 # y virInterfaceDefFree
229 # n virInterfaceFree (returns int)
230 # n virInterfaceFreeName
231 # y virInterfaceIpDefFree
232 # y virInterfaceObjFree
233 # n virInterfaceObjListFree
234 # y virInterfaceProtocolDefFree
235 # y virJSONValueFree
236 # y virLastErrFreeData
237 # y virNWFilterDefFree
238 # y virNWFilterEntryFree
239 # n virNWFilterFree (returns int)
240 # y virNWFilterHashTableFree
241 # y virNWFilterIPAddrLearnReqFree
242 # y virNWFilterIncludeDefFree
243 # n virNWFilterFreeName (returns int)
244 # y virNWFilterObjFree
245 # n virNWFilterObjListFree FIXME
246 # y virNWFilterRuleDefFree
247 # n virNWFilterRuleFreeInstanceData (typedef)
248 # y virNWFilterRuleInstFree
249 # y virNetworkDefFree
250 # n virNetworkFree (returns int)
251 # n virNetworkFreeName (returns int)
252 # y virNetworkObjFree
253 # n virNetworkObjListFree FIXME
254 # n virNodeDevCapsDefFree FIXME
255 # y virNodeDeviceDefFree
256 # n virNodeDeviceFree (returns int)
257 # y virNodeDeviceObjFree
258 # n virNodeDeviceObjListFree FIXME
259 # n virNodeGetCellsFreeMemory (returns int)
260 # n virNodeGetFreeMemory (returns non-void)
261 # y virSecretDefFree
262 # n virSecretFree (returns non-void)
263 # n virSecretFreeName (2 args)
264 # n virSecurityLabelDefFree FIXME
265 # n virStorageBackendDiskMakeFreeExtent (returns non-void)
266 # y virStorageEncryptionFree
267 # y virStorageEncryptionSecretFree
268 # n virStorageFreeType (enum)
269 # y virStoragePoolDefFree
270 # n virStoragePoolFree (returns non-void)
271 # n virStoragePoolFreeName (returns non-void)
272 # y virStoragePoolObjFree
273 # n virStoragePoolObjListFree FIXME
274 # y virStoragePoolSourceFree
275 # y virStorageVolDefFree
276 # n virStorageVolFree (returns non-void)
277 # n virStorageVolFreeName (returns non-void)
278 # n virStreamFree
279
280 # Avoid uses of write(2).  Either switch to streams (fwrite), or use
281 # the safewrite wrapper.
282 sc_avoid_write:
283         @prohibit='\<write *\('                                         \
284         in_vc_files='\.c$$'                                             \
285         halt='consider using safewrite instead of write'                \
286           $(_sc_search_regexp)
287
288 # In debug statements, print flags as bitmask and mode_t as octal.
289 sc_flags_debug:
290         @prohibit='\<mode=%[0-9.]*[diux]'                               \
291         halt='use %o to debug mode_t values'                            \
292           $(_sc_search_regexp)
293         @prohibit='[Ff]lags=%[0-9.]*l*[diou]'                           \
294         halt='use %x to debug flag values'                              \
295           $(_sc_search_regexp)
296
297 # Prefer 'unsigned int flags', along with checks for unknown flags.
298 # For historical reasons, we are stuck with 'unsigned long flags' in
299 # migration, so check for those known 4 instances and no more in public
300 # API.  Also check that no flags are marked unused, and 'unsigned' should
301 # appear before any declaration of a flags variable (achieved by
302 # prohibiting the word prior to the type from ending in anything other
303 # than d).  The existence of long long, and of documentation about
304 # flags, makes the regex in the third test slightly harder.
305 sc_flags_usage:
306         @test "$$(cat $(srcdir)/include/libvirt/libvirt.h.in            \
307             $(srcdir)/include/libvirt/virterror.h                       \
308             $(srcdir)/include/libvirt/libvirt-qemu.h                    \
309             $(srcdir)/include/libvirt/libvirt-lxc.h                     \
310           | grep -c '\(long\|unsigned\) flags')" != 4 &&                \
311           { echo '$(ME): new API should use "unsigned int flags"' 1>&2; \
312             exit 1; } || :
313         @prohibit=' flags ''ATTRIBUTE_UNUSED'                           \
314         halt='flags should be checked with virCheckFlags'               \
315           $(_sc_search_regexp)
316         @prohibit='^[^@]*([^d] (int|long long)|[^dg] long) flags[;,)]'  \
317         halt='flags should be unsigned'                                 \
318           $(_sc_search_regexp)
319
320 # Avoid functions that should only be called via macro counterparts.
321 sc_prohibit_internal_functions:
322         @prohibit='vir(Free|AllocN?|ReallocN|(Insert|Delete)ElementsN|File(Close|Fclose|Fdopen)) *\(' \
323         halt='use VIR_ macros instead of internal functions'            \
324           $(_sc_search_regexp)
325
326 # Avoid raw malloc and free, except in documentation comments.
327 sc_prohibit_raw_allocation:
328         @prohibit='^.[^*].*\<((m|c|re)alloc|free) *\([^)]'              \
329         halt='use VIR_ macros from viralloc.h instead of malloc/free'   \
330           $(_sc_search_regexp)
331
332 # Avoid functions that can lead to double-close bugs.
333 sc_prohibit_close:
334         @prohibit='([^>.]|^)\<[fp]?close *\('                           \
335         halt='use VIR_{FORCE_}[F]CLOSE instead of [f]close'             \
336           $(_sc_search_regexp)
337         @prohibit='\<fdopen *\('                                        \
338         halt='use VIR_FDOPEN instead of fdopen'                         \
339           $(_sc_search_regexp)
340
341 # Prefer virCommand for all child processes.
342 sc_prohibit_fork_wrappers:
343         @prohibit='= *\<(fork|popen|system) *\('                        \
344         halt='use virCommand for child processes'                       \
345           $(_sc_search_regexp)
346
347 # Prefer mkostemp with O_CLOEXEC.
348 sc_prohibit_mkstemp:
349         @prohibit='[^"]\<mkstemps? *\('                                 \
350         halt='use mkostemp with O_CLOEXEC instead of mkstemp'           \
351           $(_sc_search_regexp)
352
353 # access with X_OK accepts directories, but we can't exec() those.
354 # access with F_OK or R_OK is okay, though.
355 sc_prohibit_access_xok:
356         @prohibit='access''(at)? *\(.*X_OK'                             \
357         halt='use virFileIsExecutable instead of access''(,X_OK)'       \
358           $(_sc_search_regexp)
359
360 # Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
361 # Use STREQLEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
362 snp_ = strncmp *\(.+\)
363 sc_prohibit_strncmp:
364         @prohibit='! *strncmp *\(|\<$(snp_) *[!=]=|[!=]= *$(snp_)'      \
365         exclude=':# *define STR(N?EQLEN|PREFIX)\('                      \
366         halt='use STREQLEN or STRPREFIX instead of str''ncmp'           \
367           $(_sc_search_regexp)
368
369 # strtol and friends are too easy to misuse
370 sc_prohibit_strtol:
371         @prohibit='\bstrto(u?ll?|[ui]max) *\('                          \
372         exclude='exempt from syntax-check'                              \
373         halt='use virStrToLong_*, not strtol variants'                  \
374           $(_sc_search_regexp)
375         @prohibit='\bstrto[df] *\('                                     \
376         exclude='exempt from syntax-check'                              \
377         halt='use virStrToDouble, not strtod variants'                  \
378           $(_sc_search_regexp)
379
380 # Use virAsprintf rather than as'printf since *strp is undefined on error.
381 # But for plain %s, virAsprintf is overkill compared to strdup.
382 sc_prohibit_asprintf:
383         @prohibit='\<v?a[s]printf\>'                                    \
384         halt='use virAsprintf, not as'printf                            \
385           $(_sc_search_regexp)
386         @prohibit='virAsprintf.*, *"%s",'                               \
387         halt='use VIR_STRDUP instead of virAsprintf with "%s"'          \
388           $(_sc_search_regexp)
389
390 sc_prohibit_strdup:
391         @prohibit='\<strn?dup\> *\('                                    \
392         halt='use VIR_STRDUP, not strdup'                               \
393           $(_sc_search_regexp)
394
395 # Prefer virSetUIDGID.
396 sc_prohibit_setuid:
397         @prohibit='\<set(re)?[ug]id\> *\('                              \
398         halt='use virSetUIDGID, not raw set*id'                         \
399           $(_sc_search_regexp)
400
401 # Don't compare *id_t against raw -1.
402 sc_prohibit_risky_id_promotion:
403         @prohibit='\b(user|group|[ug]id) *[=!]= *-'                     \
404         halt='cast -1 to ([ug]id_t) before comparing against id'        \
405           $(_sc_search_regexp)
406
407 # Use snprintf rather than s'printf, even if buffer is provably large enough,
408 # since gnulib has more guarantees for snprintf portability
409 sc_prohibit_sprintf:
410         @prohibit='\<[s]printf\>'                                       \
411         halt='use snprintf, not s'printf                                \
412           $(_sc_search_regexp)
413
414 sc_prohibit_readlink:
415         @prohibit='\<readlink *\('                                      \
416         halt='use virFileResolveLink, not readlink'                     \
417           $(_sc_search_regexp)
418
419 sc_prohibit_gethostname:
420         @prohibit='gethostname *\('                                     \
421         halt='use virGetHostname, not gethostname'                      \
422           $(_sc_search_regexp)
423
424 sc_prohibit_readdir:
425         @prohibit='\breaddir *\('                                       \
426         exclude='exempt from syntax-check'                              \
427         halt='use virDirRead, not readdir'                              \
428           $(_sc_search_regexp)
429
430 sc_prohibit_gettext_noop:
431         @prohibit='gettext_noop *\('                                    \
432         halt='use N_, not gettext_noop'                                 \
433           $(_sc_search_regexp)
434
435 sc_prohibit_VIR_ERR_NO_MEMORY:
436         @prohibit='\<V''IR_ERR_NO_MEMORY\>'                             \
437         halt='use virReportOOMError, not V'IR_ERR_NO_MEMORY             \
438           $(_sc_search_regexp)
439
440 sc_prohibit_PATH_MAX:
441         @prohibit='\<P''ATH_MAX\>'                              \
442         halt='dynamically allocate paths, do not use P'ATH_MAX  \
443           $(_sc_search_regexp)
444
445 # Use a subshell for each function, to give the optimal warning message.
446 include $(srcdir)/Makefile.nonreentrant
447 sc_prohibit_nonreentrant:
448         @fail=0 ; \
449         for i in $(NON_REENTRANT) ; \
450         do \
451             (prohibit="\\<$$i *\\("                                     \
452              halt="use $${i}_r, not $$i"                                \
453              $(_sc_search_regexp)                                       \
454             ) || fail=1;                                                \
455         done ; \
456         exit $$fail
457
458 sc_prohibit_select:
459         @prohibit="\\<select *\\("                                      \
460         halt="use poll(), not se""lect()"                               \
461           $(_sc_search_regexp)
462
463 # Prohibit the inclusion of <ctype.h>.
464 sc_prohibit_ctype_h:
465         @prohibit='^# *include  *<ctype\.h>'                            \
466         halt="don't use ctype.h; instead, use c-ctype.h"                \
467           $(_sc_search_regexp)
468
469 # Insist on correct types for [pug]id.
470 sc_correct_id_types:
471         @prohibit='\<(int|long) *[pug]id\>'                             \
472         halt="use pid_t for pid, uid_t for uid, gid_t for gid"          \
473           $(_sc_search_regexp)
474
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'       \
482           $(_sc_search_regexp)
483         @prohibit='typedef [^(]+ [^*]\w*Ptr\b'                          \
484         halt='use correct style and type for Ptr typedefs'              \
485           $(_sc_search_regexp)
486
487 # Forbid sizeof foo or sizeof (foo), require sizeof(foo)
488 sc_size_of_brackets:
489         @prohibit='sizeof\s'                                            \
490         halt='use sizeof(foo), not sizeof (foo) or sizeof foo'          \
491           $(_sc_search_regexp)
492
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=(\.(rng|s?[ch](\.in)?|html.in|py|pl|syms)|(daemon|tools)/.*\.in)
497 sc_TAB_in_indentation:
498         @prohibit='^ *  '                                               \
499         in_vc_files='$(space_indent_files)$$'                           \
500         halt='indent with space, not TAB, in C, sh, html, py, syms and RNG schemas' \
501           $(_sc_search_regexp)
502
503 ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
504 |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
505
506 sc_avoid_ctype_macros:
507         @prohibit='\b($(ctype_re)) *\('                                 \
508         halt="don't use ctype macros (use c-ctype.h)"                   \
509           $(_sc_search_regexp)
510
511 sc_avoid_strcase:
512         @prohibit='\bstrn?case(cmp|str) *\('                            \
513         halt="don't use raw strcase functions (use c-strcase instead)"  \
514           $(_sc_search_regexp)
515
516 sc_prohibit_virBufferAdd_with_string_literal:
517         @prohibit='\<virBufferAdd *\([^,]+, *"[^"]'                     \
518         halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
519           $(_sc_search_regexp)
520
521 sc_prohibit_virBufferAsprintf_with_string_literal:
522         @prohibit='\<virBufferAsprintf *\([^,]+, *"([^%"\]|\\.|%%)*"\)'         \
523         halt='use virBufferAddLit, not virBufferAsprintf, with a string literal' \
524           $(_sc_search_regexp)
525
526 sc_forbid_manual_xml_indent:
527         @prohibit='virBuffer.*" +<'                                           \
528         halt='use virBufferAdjustIndent instead of spaces when indenting xml' \
529           $(_sc_search_regexp)
530
531 # Not only do they fail to deal well with ipv6, but the gethostby*
532 # functions are also not thread-safe.
533 sc_prohibit_gethostby:
534         @prohibit='\<gethostby(addr|name2?) *\('                        \
535         halt='use getaddrinfo, not gethostby*'                          \
536           $(_sc_search_regexp)
537
538 # dirname and basename from <libgen.h> are not required to be thread-safe
539 sc_prohibit_libgen:
540         @prohibit='( (base|dir)name *\(|include .libgen\.h)'            \
541         halt='use functions from gnulib "dirname.h", not <libgen.h>'    \
542           $(_sc_search_regexp)
543
544 # raw xmlGetProp requires some nasty casts
545 sc_prohibit_xmlGetProp:
546         @prohibit='\<xmlGetProp *\('                                    \
547         halt='use virXMLPropString, not xmlGetProp'                     \
548           $(_sc_search_regexp)
549
550 # xml(ParseURI|SaveUri) doesn't handle IPv6 URIs well
551 sc_prohibit_xmlURI:
552         @prohibit='\<xml(ParseURI|SaveUri) *\('                         \
553         halt='use virURI(Parse|Format), not xml(ParseURI|SaveUri)'      \
554           $(_sc_search_regexp)
555
556 # we don't want old old-style return with parentheses around argument
557 sc_prohibit_return_as_function:
558         @prohibit='\<return *\(([^()]*(\([^()]*\)[^()]*)*)\) *;'    \
559         halt='avoid extra () with return statements'                \
560           $(_sc_search_regexp)
561
562 # ATTRIBUTE_UNUSED should only be applied in implementations, not
563 # header declarations
564 sc_avoid_attribute_unused_in_header:
565         @prohibit='^[^#]*ATTRIBUTE_UNUSED([^:]|$$)'                     \
566         in_vc_files='\.h$$'                                             \
567         halt='use ATTRIBUTE_UNUSED in .c rather than .h files'          \
568           $(_sc_search_regexp)
569
570 sc_prohibit_int_ijk:
571         @prohibit='\<(int|unsigned) ([^(]* )*(i|j|k)\>(\s|,|;)'         \
572         halt='use size_t, not int/unsigned int for loop vars i, j, k'   \
573           $(_sc_search_regexp)
574
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'           \
578           $(_sc_search_regexp)
579
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'         \
585           $(_sc_search_regexp)
586
587 # Many of the function names below came from this filter:
588 # git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
589 # |sed 's/.*\.c-  *//'|perl -pe 's/ ?\(.*//'|sort -u \
590 # |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)$'
591
592 msg_gen_function =
593 msg_gen_function += VIR_ERROR
594 msg_gen_function += lxcError
595 msg_gen_function += regerror
596 msg_gen_function += vah_error
597 msg_gen_function += vah_warning
598 msg_gen_function += virGenericReportError
599 msg_gen_function += virRaiseError
600 msg_gen_function += virReportError
601 msg_gen_function += virReportErrorHelper
602 msg_gen_function += virReportSystemError
603 msg_gen_function += xenapiSessionErrorHandler
604
605 # Uncomment the following and run "make syntax-check" to see diagnostics
606 # that are not yet marked for translation, but that need to be rewritten
607 # so that they are translatable.
608 # msg_gen_function += fprintf
609 # msg_gen_function += testError
610 # msg_gen_function += vshPrint
611 # msg_gen_function += vshError
612
613 func_or := $(shell echo $(msg_gen_function)|tr -s ' ' '|')
614 func_re := ($(func_or))
615
616 # Look for diagnostics that aren't marked for translation.
617 # This won't find any for which error's format string is on a separate line.
618 # The sed filters eliminate false-positives like these:
619 #    _("...: "
620 #    "%s", _("no storage vol w..."
621 sc_libvirt_unmarked_diagnostics:
622         @prohibit='\<$(func_re) *\([^"]*"[^"]*[a-z]{3}'                 \
623         exclude='_\('                                                   \
624         halt='found unmarked diagnostic(s)'                             \
625           $(_sc_search_regexp)
626         @{ grep     -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT));   \
627            grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
628            | sed 's/_("\([^\"]\|\\.\)\+"//;s/[   ]"%s"//'               \
629            | grep '[     ]"' &&                                         \
630           { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
631             exit 1; } || :
632
633 # Like the above, but prohibit a newline at the end of a diagnostic.
634 # This is subject to false positives partly because it naively looks for
635 # `\n"', which may not be the end of the string, and also because it takes
636 # two lines of context (the -A2) after the line with the function name.
637 # FIXME: this rule might benefit from a separate function list, in case
638 # there are functions to which this one applies but that do not get marked
639 # diagnostics.
640 sc_prohibit_newline_at_end_of_diagnostic:
641         @grep -A2 -nE                                                   \
642             '\<$(func_re) *\(' $$($(VC_LIST_EXCEPT))                    \
643             | grep '\\n"'                                               \
644           && { echo '$(ME): newline at end of message(s)' 1>&2;         \
645             exit 1; } || :
646
647 # Look for diagnostics that lack a % in the format string, except that we
648 # allow VIR_ERROR to do this, and ignore functions that take a single
649 # string rather than a format argument.
650 sc_prohibit_diagnostic_without_format:
651         @{ grep     -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT));   \
652            grep -A2 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
653            | sed -rn -e ':l; /[,"]$$/ {N;b l;}'                          \
654                 -e '/(xenapiSessionErrorHandler|vah_(error|warning))/d'  \
655                 -e '/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p'    \
656            | grep -vE 'VIR_ERROR' &&                                     \
657           { echo '$(ME): found diagnostic without %' 1>&2;               \
658             exit 1; } || :
659
660 # The strings "" and "%s" should never be marked for translation.
661 # Files under tests/ and examples/ should not be translated.
662 sc_prohibit_useless_translation:
663         @prohibit='_\("(%s)?"\)'                                        \
664         halt='found useless translation'                                \
665           $(_sc_search_regexp)
666         @prohibit='\<N?_ *\('                                           \
667         in_vc_files='^(tests|examples)/'                                \
668         halt='no translations in tests or examples'                     \
669           $(_sc_search_regexp)
670
671 # When splitting a diagnostic across lines, ensure that there is a space
672 # or \n on one side of the split.
673 sc_require_whitespace_in_translation:
674         @grep -n -A1 '"$$' $$($(VC_LIST_EXCEPT))                        \
675            | sed -ne ':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g'  \
676                 -e '/_(.*[^\ ]""[^\ ]/p' | grep . &&                    \
677           { echo '$(ME): missing whitespace at line split' 1>&2;        \
678             exit 1; } || :
679
680 # Enforce recommended preprocessor indentation style.
681 sc_preprocessor_indentation:
682         @if cppi --version >/dev/null 2>&1; then                        \
683           $(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c        \
684             || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
685                 exit 1; };                                              \
686         else                                                            \
687           echo '$(ME): skipping test $@: cppi not installed' 1>&2;      \
688         fi
689
690 # Enforce similar spec file indentation style, by running cppi on a
691 # (comment-only) C file that mirrors the same layout as the spec file.
692 sc_spec_indentation:
693         @if cppi --version >/dev/null 2>&1; then                        \
694           for f in $$($(VC_LIST_EXCEPT) | grep '\.spec\.in$$'); do      \
695             sed -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |'            \
696                 -e 's/%\(else\|endif\|define\)/#\1/'                    \
697                 -e 's/^\( *\)\1\1\1#/#\1/'                              \
698                 -e 's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f  \
699             | cppi -a -c 2>&1 | sed "s|standard input|$$f|";            \
700           done | { if grep . >&2; then false; else :; fi; }             \
701             || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
702                 exit 1; };                                              \
703         else                                                            \
704           echo '$(ME): skipping test $@: cppi not installed' 1>&2;      \
705         fi
706
707 # Nested conditionals are easier to understand if we enforce that endifs
708 # can be paired back to the if
709 sc_makefile_conditionals:
710         @prohibit='(else|endif)($$| *#)'                                \
711         in_vc_files='Makefile\.am'                                      \
712         halt='match "if FOO" with "endif FOO" in Makefiles'             \
713           $(_sc_search_regexp)
714
715 # Long lines can be harder to diff; too long, and git send-email chokes.
716 # For now, only enforce line length on files where we have intentionally
717 # fixed things and don't want to regress.
718 sc_prohibit_long_lines:
719         @prohibit='.{90}'                                               \
720         in_vc_files='\.arg[sv]'                                         \
721         halt='Wrap long lines in expected output files'                 \
722           $(_sc_search_regexp)
723         @prohibit='.{80}'                                               \
724         in_vc_files='Makefile\.am'                                      \
725         halt='Wrap long lines in Makefiles'                             \
726           $(_sc_search_regexp)
727
728 sc_copyright_format:
729         @require='Copyright .*Red 'Hat', Inc\.'                         \
730         containing='Copyright .*Red 'Hat                                \
731         halt='Red Hat copyright is missing Inc.'                        \
732           $(_sc_search_regexp)
733         @prohibit='Copyright [^(].*Red 'Hat                             \
734         halt='consistently use (C) in Red Hat copyright'                \
735           $(_sc_search_regexp)
736         @prohibit='\<Red''Hat\>'                                        \
737         halt='spell Red Hat as two words'                               \
738           $(_sc_search_regexp)
739
740 # Prefer the new URL listing over the old street address listing when
741 # calling out where to get a copy of the [L]GPL.  Also, while we have
742 # to ship COPYING (GPL) alongside COPYING.LESSER (LGPL), we want any
743 # source file that calls out a top-level file to call out the LGPL
744 # version.  Note that our typical copyright boilerplate refers to the
745 # license by name, not by reference to a top-level file.
746 sc_copyright_usage:
747         @prohibit=Boston,' MA'                                          \
748         halt='Point to <http://www.gnu.org/licenses/>, not an address'  \
749           $(_sc_search_regexp)
750         @require='COPYING\.LESSER'                                      \
751         containing='COPYING'                                            \
752         halt='Refer to COPYING.LESSER for LGPL'                         \
753           $(_sc_search_regexp)
754         @prohibit='COPYING\.LIB'                                        \
755         halt='Refer to COPYING.LESSER for LGPL'                         \
756           $(_sc_search_regexp)
757
758 # Some functions/macros produce messages intended solely for developers
759 # and maintainers.  Do not mark them for translation.
760 sc_prohibit_gettext_markup:
761         @prohibit='\<VIR_(WARN|INFO|DEBUG) *\(_\('                      \
762         halt='do not mark these strings for translation'                \
763           $(_sc_search_regexp)
764
765 # Our code is divided into modular subdirectories for a reason, and
766 # lower-level code must not include higher-level headers.
767 cross_dirs=$(patsubst $(srcdir)/src/%.,%,$(wildcard $(srcdir)/src/*/.))
768 cross_dirs_re=($(subst / ,/|,$(cross_dirs)))
769 mid_dirs=access|conf|cpu|locking|network|node_device|rpc|security|storage
770 sc_prohibit_cross_inclusion:
771         @for dir in $(cross_dirs); do                                   \
772           case $$dir in                                                 \
773             util/) safe="util";;                                        \
774             access/ | conf/) safe="($$dir|conf|util)";;                 \
775             locking/) safe="($$dir|util|conf|rpc)";;                    \
776             cpu/| network/| node_device/| rpc/| security/| storage/)    \
777               safe="($$dir|util|conf)";;                                \
778             xenapi/ | xenxs/ ) safe="($$dir|util|conf|xen)";;           \
779             *) safe="($$dir|$(mid_dirs)|util)";;                        \
780           esac;                                                         \
781           in_vc_files="^src/$$dir"                                      \
782           prohibit='^# *include .$(cross_dirs_re)'                      \
783           exclude="# *include .$$safe"                                  \
784           halt='unsafe cross-directory include'                         \
785             $(_sc_search_regexp)                                        \
786         done
787
788 # When converting an enum to a string, make sure that we track any new
789 # elements added to the enum by using a _LAST marker.
790 sc_require_enum_last_marker:
791         @grep -A1 -nE '^[^#]*VIR_ENUM_IMPL *\(' $$($(VC_LIST_EXCEPT))   \
792            | sed -ne '/VIR_ENUM_IMPL[^,]*,$$/N'                         \
793              -e '/VIR_ENUM_IMPL[^,]*,[^,]*[^_,][^L,][^A,][^S,][^T,],/p' \
794              -e '/VIR_ENUM_IMPL[^,]*,[^,]\{0,4\},/p'                    \
795            | grep . &&                                                  \
796           { echo '$(ME): enum impl needs to use _LAST marker' 1>&2;     \
797             exit 1; } || :
798
799 # In Python files we don't want to end lines with a semicolon like in C
800 sc_prohibit_semicolon_at_eol_in_python:
801         @prohibit='^[^#].*\;$$'                                         \
802         in_vc_files='\.py$$'                                            \
803         halt="Don't use semicolon at eol in python files"               \
804           $(_sc_search_regexp)
805
806 # mymain() in test files should use return, not exit, for nicer output
807 sc_prohibit_exit_in_tests:
808         @prohibit='\<exit *\('                                          \
809         in_vc_files='^tests/'                                           \
810         halt='use return, not exit(), in tests'                         \
811           $(_sc_search_regexp)
812
813 # Don't include duplicate header in the source (either *.c or *.h)
814 sc_prohibit_duplicate_header:
815         @fail=0; for i in $$($(VC_LIST_EXCEPT) | grep '\.[chx]$$'); do  \
816           awk '/# *include.*\.h/ {                                      \
817             match($$0, /[<"][^>"]*[">]/);                               \
818             arr[substr($$0, RSTART + 1, RLENGTH - 2)]++;                \
819           }                                                             \
820           END {                                                         \
821             for (key in arr) {                                          \
822               if (arr[key] > 1) {                                       \
823                 fail=1;                                                 \
824                 printf("%d %s are included\n", arr[key], key);          \
825               }                                                         \
826             }                                                           \
827             if (fail == 1) {                                            \
828               printf("duplicate header(s) in " FILENAME "\n");          \
829               exit 1;                                                   \
830             }                                                           \
831           }' $$i || fail=1;                                             \
832         done;                                                           \
833         if test $$fail -eq 1; then                                      \
834           { echo '$(ME): avoid duplicate headers' 1>&2; exit 1; }       \
835         fi;
836
837 # Don't include "libvirt/*.h" in "" form.
838 sc_prohibit_include_public_headers_quote:
839         @prohibit='# *include *"libvirt/.*\.h"'                         \
840         in_vc_files='\.[ch]$$'                                          \
841         halt='Do not include libvirt/*.h in internal source'            \
842           $(_sc_search_regexp)
843
844 # Don't include "libvirt/*.h" in <> form. Except for external tools,
845 # e.g. Python binding, examples and tools subdirectories.
846 sc_prohibit_include_public_headers_brackets:
847         @prohibit='# *include *<libvirt/.*\.h>'                         \
848         in_vc_files='\.[ch]$$'                                          \
849         halt='Do not include libvirt/*.h in internal source'            \
850           $(_sc_search_regexp)
851
852 # <config.h> is only needed in .c files; .h files do not need it since
853 # .c files must include config.h before any other .h.
854 sc_prohibit_config_h_in_headers:
855         @prohibit='^# *include\>.*config\.h'                            \
856         in_vc_files='\.h$$'                                             \
857         halt='headers should not include <config.h>'                    \
858           $(_sc_search_regexp)
859
860 sc_prohibit_unbounded_arrays_in_rpc:
861         @prohibit='<>'                                                  \
862         in_vc_files='\.x$$'                                             \
863         halt='Arrays in XDR must have a upper limit set for <NNN>'      \
864           $(_sc_search_regexp)
865
866 sc_prohibit_getenv:
867         @prohibit='\b(secure_)?getenv *\('                              \
868         exclude='exempt from syntax-check'                              \
869         halt='Use virGetEnv{Allow,Block}SUID instead of getenv'         \
870           $(_sc_search_regexp)
871
872 sc_prohibit_atoi:
873         @prohibit='\bato(i|f|l|ll|q) *\('       \
874         halt='Use virStrToLong* instead of atoi, atol, atof, atoq, atoll' \
875           $(_sc_search_regexp)
876
877 sc_prohibit_wrong_filename_in_comment:
878         @fail=0;                                                       \
879         awk 'BEGIN {                                                   \
880           fail=0;                                                      \
881         } FNR < 3 {                                                    \
882           n=match($$0, /[[:space:]][^[:space:]]*[.][ch][[:space:]:]/); \
883           if (n > 0) {                                                 \
884             A=substr($$0, RSTART+1, RLENGTH-2);                        \
885             n=split(FILENAME, arr, "/");                               \
886             if (A != arr[n]) {                                         \
887               print "in " FILENAME ": " A " mentioned in comments ";   \
888               fail=1;                                                  \
889             }                                                          \
890           }                                                            \
891         } END {                                                        \
892           if (fail == 1) {                                             \
893             exit 1;                                                    \
894           }                                                            \
895         }' $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') || fail=1;          \
896         if test $$fail -eq 1; then                                     \
897           { echo '$(ME): The file name in comments must match the'     \
898             'actual file name' 1>&2; exit 1; }                         \
899         fi;
900
901 sc_prohibit_virConnectOpen_in_virsh:
902         @prohibit='\bvirConnectOpen[a-zA-Z]* *\('                      \
903         in_vc_files='^tools/virsh-.*\.[ch]$$'                          \
904         halt='Use vshConnect() in virsh instead of virConnectOpen*'    \
905           $(_sc_search_regexp)
906
907 sc_require_space_before_label:
908         @prohibit='^(   ?)?[_a-zA-Z0-9]+:$$'                           \
909         in_vc_files='\.[ch]$$'                                         \
910         halt="Top-level labels should be indented by one space"        \
911           $(_sc_search_regexp)
912
913 sc_curly_braces_style:
914         @files=$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$');                \
915         $(GREP) -nHP                                                   \
916 '^\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)\) ?\{' \
917         $$files && { echo '$(ME): Non-K&R style used for curly'        \
918                           'braces around function body, see'           \
919                           'HACKING' 1>&2; exit 1; } || :
920
921 sc_prohibit_windows_special_chars_in_filename:
922         @files=$$($(VC_LIST_EXCEPT) | grep '[:*?"<>|]');               \
923         test -n "$$files" && { echo '$(ME): Windows special chars'     \
924           'in filename not allowed:' 1>&2; echo $$files 1>&2; exit 1; } || :
925
926 sc_prohibit_mixed_case_abbreviations:
927         @prohibit='Pci|Usb|Scsi'                        \
928         in_vc_files='\.[ch]$$'                          \
929         halt='Use PCI, USB, SCSI, not Pci, Usb, Scsi'   \
930           $(_sc_search_regexp)
931
932 # We don't use this feature of maint.mk.
933 prev_version_file = /dev/null
934
935 ifeq (0,$(MAKELEVEL))
936   _curr_status = .git-module-status
937   # The sed filter accommodates those who check out on a commit from which
938   # no tag is reachable.  In that case, git submodule status prints a "-"
939   # in column 1 and does not print a "git describe"-style string after the
940   # submodule name.  Contrast these:
941   # -b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib
942   #  b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib (v0.0-2286-gb653eda)
943   # $ cat .git-module-status
944   # b653eda3ac4864de205419d9f41eec267cb89eeb
945   #
946   # Keep this logic in sync with autogen.sh.
947   _submodule_hash = sed 's/^[ +-]//;s/ .*//'
948   _update_required := $(shell                                           \
949       cd '$(srcdir)';                                                   \
950       test -d .git || { echo 0; exit; };                                \
951       test -f po/Makevars || { echo 1; exit; };                         \
952       test -f AUTHORS || { echo 1; exit; };                             \
953       test "no-git" = "$$(cat $(_curr_status))" && { echo 0; exit; };   \
954       actual=$$(git submodule status | $(_submodule_hash);              \
955                 git hash-object bootstrap.conf;                         \
956                 git ls-tree -d HEAD gnulib/local | awk '{print $$3}';   \
957                 git diff .gnulib);                                      \
958       stamp="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)";       \
959       test "$$stamp" = "$$actual"; echo $$?)
960   _clean_requested = $(filter %clean,$(MAKECMDGOALS))
961   ifeq (1,$(_update_required)$(_clean_requested))
962     $(info INFO: gnulib update required; running ./autogen.sh first)
963     $(shell touch $(srcdir)/AUTHORS $(srcdir)/ChangeLog)
964 maint.mk Makefile: _autogen
965   endif
966 endif
967
968 # It is necessary to call autogen any time gnulib changes.  Autogen
969 # reruns configure, then we regenerate all Makefiles at once.
970 .PHONY: _autogen
971 _autogen:
972         $(srcdir)/autogen.sh
973         ./config.status
974
975 # regenerate HACKING as part of the syntax-check
976 syntax-check: $(top_srcdir)/HACKING bracket-spacing-check
977
978 bracket-spacing-check:
979         $(AM_V_GEN)files=`$(VC_LIST) | grep '\.c$$'`; \
980         $(PERL) $(top_srcdir)/build-aux/bracket-spacing.pl $$files || \
981           { echo '$(ME): incorrect whitespace, see HACKING for rules' 1>&2; \
982             exit 1; }
983
984 # sc_po_check can fail if generated files are not built first
985 sc_po_check: \
986                 $(srcdir)/daemon/remote_dispatch.h \
987                 $(srcdir)/daemon/qemu_dispatch.h \
988                 $(srcdir)/src/remote/remote_client_bodies.h
989 $(srcdir)/daemon/remote_dispatch.h: $(srcdir)/src/remote/remote_protocol.x
990         $(MAKE) -C daemon remote_dispatch.h
991 $(srcdir)/daemon/qemu_dispatch.h: $(srcdir)/src/remote/qemu_protocol.x
992         $(MAKE) -C daemon qemu_dispatch.h
993 $(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protocol.x
994         $(MAKE) -C src remote/remote_client_bodies.h
995
996 # List all syntax-check exemptions:
997 exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.h$$
998
999 _src1=libvirt|fdstream|qemu/qemu_monitor|util/(vircommand|virfile)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon
1000 _test1=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock
1001 exclude_file_name_regexp--sc_avoid_write = \
1002   ^(src/($(_src1))|daemon/libvirtd|tools/virsh-console|tests/($(_test1)))\.c$$
1003
1004 exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
1005
1006 exclude_file_name_regexp--sc_copyright_usage = \
1007   ^COPYING(|\.LESSER)$$
1008
1009 exclude_file_name_regexp--sc_flags_usage = \
1010   ^(docs/|src/util/virnetdevtap\.c$$|tests/vir(cgroup|pci|usb)mock\.c$$)
1011
1012 exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
1013   ^(src/rpc/gendispatch\.pl$$|tests/)
1014
1015 exclude_file_name_regexp--sc_po_check = ^(docs/|src/rpc/gendispatch\.pl$$)
1016
1017 exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY = \
1018   ^(include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virerror\.c|docs/internals/oomtesting\.html\.in)$$
1019
1020 exclude_file_name_regexp--sc_prohibit_access_xok = ^src/util/virutil\.c$$
1021
1022 exclude_file_name_regexp--sc_prohibit_asprintf = \
1023   ^(bootstrap.conf$$|src/util/virstring\.[ch]$$|tests/vircgroupmock\.c$$)
1024
1025 exclude_file_name_regexp--sc_prohibit_strdup = \
1026   ^(docs/|examples/|src/util/virstring\.c|tests/virnetserverclientmock.c$$)
1027
1028 exclude_file_name_regexp--sc_prohibit_close = \
1029   (\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt\.c|tests/vir(cgroup|pci)mock\.c)$$)
1030
1031 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
1032   (^tests/(qemuhelp|nodeinfo|virpcitest)data/|\.(gif|ico|png|diff)$$)
1033
1034 _src2=src/(util/vircommand|libvirt|lxc/lxc_controller|locking/lock_daemon)
1035 exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
1036   (^($(_src2)|tests/testutils|daemon/libvirtd)\.c$$)
1037
1038 exclude_file_name_regexp--sc_prohibit_gethostname = ^src/util/virutil\.c$$
1039
1040 exclude_file_name_regexp--sc_prohibit_internal_functions = \
1041   ^src/(util/(viralloc|virutil|virfile)\.[hc]|esx/esx_vi\.c)$$
1042
1043 exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic = \
1044   ^src/rpc/gendispatch\.pl$$
1045
1046 exclude_file_name_regexp--sc_prohibit_nonreentrant = \
1047   ^((po|tests)/|docs/.*(py|html\.in)|run.in$$|tools/wireshark/util/genxdrstub\.pl$$)
1048
1049 exclude_file_name_regexp--sc_prohibit_raw_allocation = \
1050   ^(docs/hacking\.html\.in)|(src/util/viralloc\.[ch]|examples/.*|tests/securityselinuxhelper\.c|tests/vircgroupmock\.c|tools/wireshark/src/packet-libvirt.c)$$
1051
1052 exclude_file_name_regexp--sc_prohibit_readlink = \
1053   ^src/(util/virutil|lxc/lxc_container)\.c$$
1054
1055 exclude_file_name_regexp--sc_prohibit_setuid = ^src/util/virutil\.c$$
1056
1057 exclude_file_name_regexp--sc_prohibit_sprintf = \
1058   ^(docs/hacking\.html\.in)|(examples/systemtap/.*stp)|(src/dtrace2systemtap\.pl)|(src/rpc/gensystemtap\.pl)|(tools/wireshark/util/genxdrstub\.pl)$$
1059
1060 exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/virstring\.c$$
1061
1062 exclude_file_name_regexp--sc_prohibit_strtol = \
1063   ^(src/(util/virsexpr|(vbox|xen|xenxs)/.*)\.c)|(examples/domsuspend/suspend.c)$$
1064
1065 exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/virxml\.c$$
1066
1067 exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$
1068
1069 exclude_file_name_regexp--sc_prohibit_return_as_function = \.py$$
1070
1071 exclude_file_name_regexp--sc_require_config_h = \
1072         ^(examples/|tools/virsh-edit\.c$$)
1073
1074 exclude_file_name_regexp--sc_require_config_h_first = \
1075         ^(examples/|tools/virsh-edit\.c$$)
1076
1077 exclude_file_name_regexp--sc_trailing_blank = \
1078   (/qemuhelpdata/|/sysinfodata/.*\.data|\.(fig|gif|ico|png)$$)
1079
1080 exclude_file_name_regexp--sc_unmarked_diagnostics = \
1081   ^(docs/apibuild.py|tests/virt-aa-helper-test)$$
1082
1083 exclude_file_name_regexp--sc_size_of_brackets = cfg.mk
1084
1085 exclude_file_name_regexp--sc_correct_id_types = \
1086   (^src/locking/lock_protocol.x$$)
1087
1088 exclude_file_name_regexp--sc_m4_quote_check = m4/virt-lib.m4
1089
1090 exclude_file_name_regexp--sc_prohibit_include_public_headers_quote = \
1091   ^(src/internal\.h$$|tools/wireshark/src/packet-libvirt.h$$)
1092
1093 exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \
1094   ^(tools/|examples/|include/libvirt/(virterror|libvirt-(qemu|lxc))\.h$$)
1095
1096 exclude_file_name_regexp--sc_prohibit_int_ijk = \
1097   ^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/)$
1098
1099 exclude_file_name_regexp--sc_prohibit_getenv = \
1100   ^tests/.*\.[ch]$$
1101
1102 exclude_file_name_regexp--sc_avoid_attribute_unused_in_header = \
1103   ^src/util/virlog\.h$$
1104
1105 exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations = \
1106   ^src/(vbox/vbox_CAPI.*.h|esx/esx_vi.(c|h)|esx/esx_storage_backend_iscsi.c)$$