meson: don't use intermediate variables that are immediately discarded
authorDylan Baker <dylan@pnwbakers.com>
Tue, 12 Dec 2017 00:16:56 +0000 (16:16 -0800)
committerDylan Baker <dylan@pnwbakers.com>
Thu, 11 Jan 2018 23:40:02 +0000 (15:40 -0800)
For things like:
loop
    x = func()
    list += x
end

just do:
loop
    list += func()
end

Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
src/broadcom/cle/meson.build
src/intel/genxml/meson.build
src/intel/isl/meson.build
src/intel/vulkan/meson.build
src/mesa/drivers/dri/i965/meson.build

index 32510cee5ef6ff3af8d576b44045bf17e0a72443..1534fc9d82b29ec766c5b7ba26b70bd813cf88f5 100644 (file)
@@ -39,14 +39,13 @@ v3d_xml_h = custom_target(
 v3d_xml_pack = []
 foreach f : v3d_xml_files
   _name = '@0@_pack.h'.format(f.split('.')[0])
-  _xml = custom_target(
+  v3d_xml_pack += custom_target(
     _name,
     input : ['gen_pack_header.py', f],
     output : _name,
     command : [prog_python2, '@INPUT@'],
     capture : true,
   )
-  v3d_xml_pack += _xml
 endforeach
 
 libbroadcom_cle = static_library(
index 30c0d8bf2f6ba1db2d4cf75d9d0c586daeae2121..371f85307c85b2428bb608c4ad2ca146415b3da8 100644 (file)
@@ -48,12 +48,11 @@ genX_bits_h = custom_target(
 gen_xml_pack = []
 foreach f : gen_xml_files
   _name = '@0@_pack.h'.format(f.split('.')[0])
-  _xml = custom_target(
+  gen_xml_pack += custom_target(
     _name,
     input : ['gen_pack_header.py', f],
     output : _name,
     command : [prog_python2, '@INPUT@'],
     capture : true,
   )
-  gen_xml_pack += _xml
 endforeach
index 116750d86d6659298a7fbf0d6f5c034567356c2a..0838c32af3254cb4c04453bfa4df8be722669303 100644 (file)
@@ -53,15 +53,13 @@ foreach g : [['40', isl_gen4_files], ['50', []], ['60', isl_gen6_files],
              ['70', isl_gen7_files], ['75', []], ['80', isl_gen8_files],
              ['90', isl_gen9_files], ['100', []]]
   _gen = g[0]
-  _sources = g[1]
-  _lib = static_library(
+  isl_gen_libs += static_library(
     'libisl_gen@0@'.format(_gen),
-    [_sources, isl_gen_files, gen_xml_pack],
+    [g[1], isl_gen_files, gen_xml_pack],
     include_directories : [inc_common, inc_intel],
     c_args : [c_vis_args, no_override_init_args,
               '-DGEN_VERSIONx10=@0@'.format(_gen)],
   )
-  isl_gen_libs += _lib
 endforeach
 
 isl_format_layout_c = custom_target(
index 66266a0e95a1cb41ad5830fa72758e564b4f922c..4cd7a025813017d229d7c313a6c67ac7d5c60d46 100644 (file)
@@ -89,10 +89,9 @@ foreach g : [['70', ['gen7_cmd_buffer.c']], ['75', ['gen7_cmd_buffer.c']],
              ['80', ['gen8_cmd_buffer.c']], ['90', ['gen8_cmd_buffer.c']],
              ['100', ['gen8_cmd_buffer.c']]]
   _gen = g[0]
-  _files = g[1]
-  _lib = static_library(
+  libanv_gen_libs += static_library(
     'libanv_gen@0@'.format(_gen),
-    [anv_gen_files, _files, block_entrypoints],
+    [anv_gen_files, g[1], block_entrypoints],
     include_directories : [
       inc_common, inc_compiler, inc_drm_uapi, inc_intel, inc_vulkan_util,
       inc_vulkan_wsi,
@@ -103,7 +102,6 @@ foreach g : [['70', ['gen7_cmd_buffer.c']], ['75', ['gen7_cmd_buffer.c']],
     ],
     dependencies : [dep_libdrm, dep_valgrind],
   )
-  libanv_gen_libs += _lib
 endforeach
 
 libanv_files = files(
index e3bf9cc51bb9e4fc97b72cdc670de4e922eeaae4..1183978b7b3c85259a0df7ba6fecd1a32399e46d 100644 (file)
@@ -136,7 +136,7 @@ files_i965 = files(
 
 i965_gen_libs = []
 foreach v : ['40', '45', '50', '60', '70', '75', '80', '90', '100']
-  _lib = static_library(
+  i965_gen_libs += static_library(
     'libi965_gen@0@'.format(v),
     ['genX_blorp_exec.c', 'genX_state_upload.c', nir_opcodes_h, gen_xml_pack],
     include_directories : [inc_common, inc_intel, inc_dri_common],
@@ -146,7 +146,6 @@ foreach v : ['40', '45', '50', '60', '70', '75', '80', '90', '100']
     ],
     dependencies : [dep_libdrm],
   )
-  i965_gen_libs += _lib
 endforeach
 
 oa_generator = generator(