From patchwork Tue May 14 17:16:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ijaz, Abdul B" X-Patchwork-Id: 90140 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5CDB23870C1F for ; Tue, 14 May 2024 17:16:55 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by sourceware.org (Postfix) with ESMTPS id 8C5F53858C35 for ; Tue, 14 May 2024 17:16:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C5F53858C35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8C5F53858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.14 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715706987; cv=none; b=RX7gwWIXhVxtOTijSh3nY5Sx75BtJoKXy+loupSfqJhdpQ663y/rbaCljDcN+IwhSJUmliDPQQ3NuiUEA+7ZOI1GJYUDuA18LXMRNmEVbSYv5Cb9U6uypnhCezGcof/QYSRcseQ+irViRoKwBljhzmuIEZEl7DdZBE0o3+LAjwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715706987; c=relaxed/simple; bh=amWrbLjxVFZBHeMg54TwZGytNs8J7U1t73LKKYafx6M=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=wfLj9BdQ7woMySE3+v75SYGmsCi1HwY6sXTx/CT6QzVMgdiHwVobNB2jQOw8OpBnrS+a55nSIzVz8RXZA5sBgaaaMfTcoOp3YhJKZlQZtlrIy3uOWRwmTuRHNeVXHpxe+NdURkfen+WfFVQxjLwEMqH3ORxJLsKgFM+KcB3Ytus= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715706984; x=1747242984; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=amWrbLjxVFZBHeMg54TwZGytNs8J7U1t73LKKYafx6M=; b=hfPzE91BXv+dIArHO9VmQqsP11pcA44sjForXY+sQaOQZ5h6tjRC/+8V sCmXyEEM0f1wQMJiZz4eRy+p3XLXhYK0btJRRh596SUd74FvZaYJEPQin 7KtrmU4R0qj/Yb0ty3pgJst7Il8iJpV4oyrXt4XrBykA+b+WReAz0AtQU j2janXO81Z7/YouUktSnVPs9t2nziLUq0en0VYlQlfg/BRv25zjXzSBUR KgIXSMrviD88PuU28EzUMfXitkWo9y8Ls5cs4TJdOwCU05spF9tgyPRMS 5H6h2v6HgeOOYyAdw87dwV/9OphMNTswjSqlG2QzNX7/znMmfK43CtS/k g==; X-CSE-ConnectionGUID: TMbVVW0mSmid9/72IyoQ1w== X-CSE-MsgGUID: b9A5ocBkSQq2c35AdQDiFA== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="11922641" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="11922641" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 10:16:24 -0700 X-CSE-ConnectionGUID: KWtf9NZiRy24cPM0bxvAPQ== X-CSE-MsgGUID: cztcoe6LRdScjm+TphgQ7A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="30690758" Received: from abijaz-mobl2.ger.corp.intel.com (HELO localhost) ([10.246.42.1]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 10:16:22 -0700 From: Abdul Basit Ijaz To: gdb-patches@sourceware.org Cc: abdul.b.ijaz@intel.com, christina.schimpe@intel.com, felix.willgerodt@intel.com, keiths@redhat.com Subject: [PATCH v2 1/1] gdb, testsuite: Handle unused compiler option fdiagnostics-color=never. Date: Tue, 14 May 2024 19:16:03 +0200 Message-Id: <20240514171603.18486-2-abdul.b.ijaz@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240514171603.18486-1-abdul.b.ijaz@intel.com> References: <20240514171603.18486-1-abdul.b.ijaz@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org From: "Ijaz, Abdul B" The 'univeral_compile_options' in gdb.exp file only verifies the support of '-fdiagnostics-color=never' for the "C" source file. So while running tests with assembly source file (.s), many of them are not able to run on icx/clang compilers because '-fdiagnostics-color=never' option is not supported. After this change, this function is split into multiple functions to check the support for different type of sources individually. Before this change, in the case of clang and ICX compiler, this error is shown for assembly source files: ''' icx -fdiagnostics-color=never -Wno-unknown-warning-option -fno-pie -c -O0 -o amd64-entry-value0.o gdb/testsuite/gdb.arch/amd64-entry-value.s (timeout = 300) icx: warning: argument unused during compilation: '-fdiagnostics-color=never' [-Wunused-command-line-argument] gdb compile failed, icx: warning: argument unused during compilation: '-fdiagnostics-color=never' [-Wunused-command-line-argument] UNTESTED: gdb.arch/amd64-entry-value.exp: failed to prepare ''' Similarly this error is shown for the clang compiler: ''' clang -fdiagnostics-color=never -Wno-unknown-warning-option -fno-pie -c -O0 -o amd64-entry-value0.o gdb/testsuite/gdb.arch/amd64-entry-value.s clang: warning: argument unused during compilation: '-fdiagnostics-color=never' [-Wunused-command-line-argument] ''' --- gdb/testsuite/lib/gdb.exp | 52 +++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 0d78691c381..54c61c95d79 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5046,17 +5046,9 @@ proc gdb_wrapper_init { args } { } # Determine options that we always want to pass to the compiler. -gdb_caching_proc universal_compile_options {} { - set me "universal_compile_options" +proc universal_compile_options {src obj} { set options {} - set src [standard_temp_file ccopts.c] - set obj [standard_temp_file ccopts.o] - - gdb_produce_source $src { - int foo(void) { return 0; } - } - # Try an option for disabling colored diagnostics. Some compilers # yield colored diagnostics by default (when run from a tty) unless # such an option is specified. @@ -5066,6 +5058,23 @@ gdb_caching_proc universal_compile_options {} { # Seems to have worked; use the option. lappend options $opt } + + return $options +} + +# Determine options that we always want to pass to the C compiler. +gdb_caching_proc universal_compile_options_c {} { + set me "universal_compile_options_c" + + set src [standard_temp_file ccopts.c] + set obj [standard_temp_file ccopts.o] + + gdb_produce_source $src { + int foo(void) { return 0; } + } + + set options [universal_compile_options $src $obj] + file delete $src file delete $obj @@ -5073,6 +5082,25 @@ gdb_caching_proc universal_compile_options {} { return $options } +# Determine options that we always want to pass to the compiler for +# assembly source files with the extension ".s". +gdb_caching_proc universal_compile_options_assembly {} { + set me "universal_compile_options_assembly" + + set src [standard_temp_file ccopts.s] + set obj [standard_temp_file csymbol.o] + + gdb_produce_source $src { + main: + } + + set options [universal_compile_options $src $obj] + file delete $obj + + verbose "$me: returning $options" 2 + return $options +} + # Compile the code in $code to a file based on $name, using the flags # $compile_flag as well as debug, nowarning and quiet (unless otherwise # specified in default_compile_flags). @@ -5252,7 +5280,11 @@ proc gdb_compile {source dest type options} { if {[lsearch -exact $options rust] != -1} { # -fdiagnostics-color is not a rustcc option. } else { - set new_options [universal_compile_options] + if {[string match *.s $source] != 0} { + set new_options [universal_compile_options_assembly] + } else { + set new_options [universal_compile_options_c] + } } # C/C++ specific settings.