From nobody Tue Feb 10 15:45:40 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1688738735; cv=none; d=zohomail.com; s=zohoarc; b=Qk3cK0Bg3wkckNkGrsbp7t5rHSYaNa5UwkTzprEIwYw4tNkLH85iHNQUoPLdinVP1w0XbHMxOwrKco0iu+Le68Flk5U5dHceRCa9uupPTSFJ+kEpsLGUSoAKvx6tfoJEZCndXeoYPbgvNZ16WuWmDuF07VToxUsnM86NT46WED4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688738735; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0z06+ySLDI//4HgzANh/bhuBzMpaxFijzGez2Mql6tw=; b=fdvD/+YWAbrV+PYZ/soM30Gc7i5v/y6kMZkpDnDmdqXZWjBlidej6DrUNZ9zzJjpBfit7qp4RCwRZfZje9q/BUct7secHbovhmp3KaVTSBT+ZQTkBiaBwx5fP95XeljxG5FwvJgxL/qbAB8s7a/h+ATLzCQAxmlMVQz+/ufEQBM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16887387350411013.6284180002312; Fri, 7 Jul 2023 07:05:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHm4k-0007By-Ux; Fri, 07 Jul 2023 10:04:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHm4h-0007Az-HB for qemu-devel@nongnu.org; Fri, 07 Jul 2023 10:04:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHm4f-0006MT-QH for qemu-devel@nongnu.org; Fri, 07 Jul 2023 10:04:43 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-139-1halClEQN1i77WvsJftSNQ-1; Fri, 07 Jul 2023 10:04:39 -0400 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9879d2fc970so134962166b.0 for ; Fri, 07 Jul 2023 07:04:39 -0700 (PDT) Received: from [192.168.122.1] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id v1-20020a170906b00100b00993a9a951fasm2283403ejy.11.2023.07.07.07.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 07:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688738681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0z06+ySLDI//4HgzANh/bhuBzMpaxFijzGez2Mql6tw=; b=fgEPqIImkghvwu3kNeTZiXM2VXGYOUGGkZ+uxEB2o0loF0Vloat8s9sgLeXI9Ggw3k019j FhiUBiGV7is7p5T4OkJGinRCYnVEAGd5aIxdFsmq/4lvyFcycxXqbciZbQmrWwi+pVKhCK yYjl/ZsZGUM3Llq6cqe8D5UZj1WQ7Mk= X-MC-Unique: 1halClEQN1i77WvsJftSNQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688738677; x=1691330677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0z06+ySLDI//4HgzANh/bhuBzMpaxFijzGez2Mql6tw=; b=CtW+noTkM5MhZdCfV/5zOkG8AierA/moyTfy/vmhng5VmSNC1vmEf0OogH5KpwSGMH CFQiudfSeW/nC2MK4aKKsptfu1crYls6oWAPVKRvUegh/iYIkvDAKRI+UmPr6eGNANz1 hlAx9/NLSWaEhiZ7dWwvJHoz63DN+joUsy5cJamwKWX1uvm/onxUkDCgk7/V+qEvw1rO TIQ8e2nHUtnRfkIn43ZL0hA6vZl7r4GcNZTA/a05hJT51XfEB8x5H+oHZoixD3R6aAMj OGZdVhzjFIRhNyXxr4KaTaqo/wC6xuN4HuAJBFQKiN881Dv2W7ISUjRy+JUCqnZiOyUk 6bgQ== X-Gm-Message-State: ABy/qLbCT536Fm8Iml4dXAF2vfoaNavniDAQBqCORtmasgG4K/QYd5rQ 8zEpRd9/FqPTKyR/NIcNowsgrxZcilfPC9QsPF7AZhAWcv44JCHBNsn+7nF7M5TxsJ9p85YsRCP 3G142NmcIwZMPaMGMo4FMupNT13Au886ecIVn5tON6QmTz2aE1YxAaqHobNhFTZyLOFs3A+0VIB k= X-Received: by 2002:a17:906:72d9:b0:978:6e73:e837 with SMTP id m25-20020a17090672d900b009786e73e837mr4240538ejl.4.1688738677635; Fri, 07 Jul 2023 07:04:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlGxogkQhm9tY2fwdcLLAnlh0YpZzg1kOwC5pfhkyyguwwPeNNK+q3xV3ejkXoDHMASSk4vyxg== X-Received: by 2002:a17:906:72d9:b0:978:6e73:e837 with SMTP id m25-20020a17090672d900b009786e73e837mr4240515ejl.4.1688738677167; Fri, 07 Jul 2023 07:04:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Thomas Huth Subject: [PULL 2/9] meson.build: Remove the logic to link C code with the C++ linker Date: Fri, 7 Jul 2023 16:04:25 +0200 Message-ID: <20230707140432.88073-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230707140432.88073-1-pbonzini@redhat.com> References: <20230707140432.88073-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1688738736311100001 Content-Type: text/plain; charset="utf-8" From: Thomas Huth We are not mixing C++ with C code anymore, the only remaining C++ code in qga/vss-win32/ is used for a plain C++ executable. Thus we can remove the hacks for linking C code with the C++ linker now to simplify meson.build a little bit, and also to avoid that some C++ code sneaks in by accident again. Signed-off-by: Thomas Huth Message-ID: <20230706064736.178962-1-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 22 ++++++---------------- qga/meson.build | 2 +- scripts/main.c | 1 - 3 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 scripts/main.c diff --git a/meson.build b/meson.build index b82d5b7cd07..c77faa0b6e5 100644 --- a/meson.build +++ b/meson.build @@ -473,19 +473,10 @@ if targetos !=3D 'darwin' warn_flags +=3D ['-Wthread-safety'] endif =20 -# Check that the C++ compiler exists and works with the C compiler. -link_language =3D 'c' -linker =3D cc +# Set up C++ compiler flags qemu_cxxflags =3D [] if 'cpp' in all_languages qemu_cxxflags =3D ['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', = '-D__STDC_FORMAT_MACROS'] + qemu_cflags - if cxx.links(files('scripts/main.c'), args: qemu_cflags) - link_language =3D 'cpp' - linker =3D cxx - else - message('C++ compiler does not work with C compiler') - message('Disabling C++-specific optional code') - endif endif =20 # clang does not support glibc + FORTIFY_SOURCE (is it still true?) @@ -1600,7 +1591,7 @@ if not get_option('snappy').auto() or have_system snappy =3D cc.find_library('snappy', has_headers: ['snappy-c.h'], required: get_option('snappy')) endif -if snappy.found() and not linker.links(''' +if snappy.found() and not cc.links(''' #include int main(void) { snappy_max_compressed_length(4096); return 0; }''', de= pendencies: snappy) snappy =3D not_found @@ -2746,7 +2737,7 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.has_header= _symbol( =20 have_vss =3D false have_vss_sdk =3D false # old xp/2003 SDK -if targetos =3D=3D 'windows' and link_language =3D=3D 'cpp' +if targetos =3D=3D 'windows' and 'cpp' in all_languages have_vss =3D cxx.compiles(''' #define __MIDL_user_allocate_free_DEFINED__ #include @@ -3827,7 +3818,6 @@ foreach target : target_dirs c_args: c_args, dependencies: arch_deps + deps + exe['dependencies'], objects: lib.extract_all_objects(recursive: true), - link_language: link_language, link_depends: [block_syms, qemu_syms] + exe.get('link_depen= ds', []), link_args: link_args, win_subsystem: exe['win_subsystem']) @@ -4061,7 +4051,7 @@ summary_info +=3D {'host CPU': cpu} summary_info +=3D {'host endianness': build_machine.endian()} summary_info +=3D {'C compiler': ' '.join(meson.get_compiler('c').c= md_array())} summary_info +=3D {'Host C compiler': ' '.join(meson.get_compiler('c', n= ative: true).cmd_array())} -if link_language =3D=3D 'cpp' +if 'cpp' in all_languages summary_info +=3D {'C++ compiler': ' '.join(meson.get_compiler('cpp')= .cmd_array())} else summary_info +=3D {'C++ compiler': false} @@ -4074,13 +4064,13 @@ if get_option('optimization') !=3D 'plain' option_cflags +=3D ['-O' + get_option('optimization')] endif summary_info +=3D {'CFLAGS': ' '.join(get_option('c_args') + op= tion_cflags)} -if link_language =3D=3D 'cpp' +if 'cpp' in all_languages summary_info +=3D {'CXXFLAGS': ' '.join(get_option('cpp_args') + = option_cflags)} endif if targetos =3D=3D 'darwin' summary_info +=3D {'OBJCFLAGS': ' '.join(get_option('objc_args') += option_cflags)} endif -link_args =3D get_option(link_language + '_link_args') +link_args =3D get_option('c_link_args') if link_args.length() > 0 summary_info +=3D {'LDFLAGS': ' '.join(link_args)} endif diff --git a/qga/meson.build b/qga/meson.build index d3291b4376c..dd18092f561 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -9,7 +9,7 @@ endif have_qga_vss =3D get_option('qga_vss') \ .require(targetos =3D=3D 'windows', error_message: 'VSS support requires Windows') \ - .require(link_language =3D=3D 'cpp', + .require('cpp' in all_languages, error_message: 'VSS support requires a C++ compiler') \ .require(have_vss, error_message: '''VSS support requires VSS headers. If your Visual Studio installation doesn't have the VSS headers, diff --git a/scripts/main.c b/scripts/main.c deleted file mode 100644 index b552c8e4ed7..00000000000 --- a/scripts/main.c +++ /dev/null @@ -1 +0,0 @@ -int main(void) {} --=20 2.41.0