From patchwork Fri Mar 22 13:55:05 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: 87520 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 10D2E385842C for ; Fri, 22 Mar 2024 13:55:43 +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.11]) by sourceware.org (Postfix) with ESMTPS id 74ED13858D32 for ; Fri, 22 Mar 2024 13:55:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74ED13858D32 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 74ED13858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711115719; cv=none; b=jCnm8oH/OdFOaz9EhcZ63pZLjZ8Y04+cI+HBm0MH4i62SXJiJhAvrTNbJiRTpGsKlOLyjm7WRW5xkY90H/qIBJ3T36vCD/tQIhLE259JpSrTlT09MiMt3JNxXOz+P2jTnUZqIzFpNQFUkSCcnHOW1GqRTa/328Qekcrl5TfNBGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711115719; c=relaxed/simple; bh=j/v7gbB2XTrQqSNg3NjTfHMTX6lH62PmB/OWPLRS/mc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=OtZjaGnKph4gaQwppL6xkdGUQ9sior6pRsKlc9nv1zlc04SDP6BObanbTpBMVND/8Gi+0GoIqQy/C6kqrO5seHDLZ6stztGgnIjy6xb1Ger5BVa4+L5lych4Vtv10e41dTSa+6Kg43BMuYtLatmI/IS1VIXkD/LBECzl5oHJiYk= 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=1711115717; x=1742651717; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=j/v7gbB2XTrQqSNg3NjTfHMTX6lH62PmB/OWPLRS/mc=; b=kkQMHBt4BwwuC8wLyvmyBkzZLcMXm04eL+n9c2qlBkcstIiJ+o/wkKW6 2rgot/4Q2SnN9uoZ9RRaP/eGE8HQUmOxrzVtwc6hqDdNBnENHXaxDk3xm BW7iucZl/akzIy/byQQKbkJU4mVQkzxybY1ngbzNjw2QLVJQgCVzPgZQD zhBQq4arLQ7wGyku1E/Xw6q32TgofiSSP0c3ZZD/xsHvJDoGaD9o8Oi9H OpiLm9hIgmTG91WSMCoI7m3yISGV9cfdT6LtUpmb5WsjiGNGKSlc78QUV u/1lpUizp9ldYamO8PAsl7Wnuttm9Dd/tAXsnyUqSjUyobwNhLBwJ0Spo g==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="16798887" X-IronPort-AV: E=Sophos;i="6.07,146,1708416000"; d="scan'208";a="16798887" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2024 06:55:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,146,1708416000"; d="scan'208";a="52348183" Received: from abijaz-mobl2.ger.corp.intel.com (HELO localhost) ([10.246.42.1]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2024 06:55:14 -0700 From: Abdul Basit Ijaz To: gdb-patches@sourceware.org Cc: abdul.b.ijaz@intel.com, christina.schimpe@intel.com, felix.willgerodt@intel.com Subject: [PATCH 1/1] gdb, testsuite: Handle unused compiler option fdiagnostics-color=never. Date: Fri, 22 Mar 2024 14:55:05 +0100 Message-Id: <20240322135505.23230-1-abdul.b.ijaz@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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] ''' 2024-03-22 Ijaz, Abdul B _ --- gdb/testsuite/lib/gdb.exp | 48 +++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index a0c4855ffc5..4f19162b3ce 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5018,17 +5018,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. @@ -5038,6 +5030,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) { int arr[100]={0}; return 0; } + } + + set options [universal_compile_options $src $obj] + file delete $src file delete $obj @@ -5045,6 +5054,21 @@ 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 obj [standard_temp_file csymbol.o] + set src "$::srcdir/gdb.arch/amd64-entry-value.s" + + 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). @@ -5224,7 +5248,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.