]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: Automatic Variable Initialization
authorFred Morcos <fred.morcos@open-xchange.com>
Fri, 4 Aug 2023 11:53:49 +0000 (13:53 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 12:28:32 +0000 (13:28 +0100)
meson.build
meson/auto-var-init/meson.build [new file with mode: 0644]
meson_options.txt

index 5351dd54fe62661420eeebfac3f07b3f6fb1548f..3624957873b0059bf1bc713ab78ec148e9d9656f 100644 (file)
@@ -67,6 +67,7 @@ subdir('meson/auth-tools')               # Tools
 subdir('meson/ixfrdist')                 # Ixfrdist
 subdir('meson/systemd')                  # Systemd and unit file handling
 subdir('meson/code-coverage')            # Code coverage
+subdir('meson/auto-var-init')            # Automatic Variable Initialization
 
 # Find or generate pdns/dnslabeltext.cc
 if not ragel.found() and not fs.exists('pdns/dnslabeltext.cc')
diff --git a/meson/auto-var-init/meson.build b/meson/auto-var-init/meson.build
new file mode 100644 (file)
index 0000000..5fc4d31
--- /dev/null
@@ -0,0 +1,15 @@
+# Automatic Variable Initialization
+
+auto_var_init = get_option('auto-var-init')
+
+if auto_var_init != 'disabled'
+  arg = '-ftrivial-auto-var-init=' + auto_var_init
+  if not cxx.has_argument(arg)
+    error('Compiler does not support ' + arg + ', which is needed for automatic variable initialization')
+    subdir_done()
+  endif
+
+  add_global_arguments(arg)
+endif
+
+summary('Auto Var Init', auto_var_init, section: 'Configuration')
index a824379211e4aab7f26372d163ebd1fe7f2d96b9..8732734a9ce244bc023fb51226f09a07ef53aae1 100644 (file)
@@ -47,3 +47,4 @@ option('lua-records', type: 'boolean', value: true, description: 'Build support
 option('systemd-service-user', type: 'string', value: 'pdns', description: 'User to run the systemd pdns service as. Only the setuid setting and User field in the systemd unit file are affected, the user is not created')
 option('systemd-service-group', type: 'string', value: 'pdns', description: 'Group to run the systemd pdns service under. Only the setgid setting and Group field in the systemd unit file are affected, the group is not created')
 option('code-coverage', type: 'boolean', value: false, description: 'Enable code coverage')
+option('auto-var-init', type: 'combo', value: 'disabled', choices: ['zero', 'pattern', 'disabled'], description: 'Enable initialization of automatic variables')