From patchwork Wed May 15 20:31:28 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: 90215 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 53B98384AB65 for ; Wed, 15 May 2024 20:32:11 +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.12]) by sourceware.org (Postfix) with ESMTPS id 392AD3858D20 for ; Wed, 15 May 2024 20:31:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 392AD3858D20 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 392AD3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715805110; cv=none; b=P8jKUTMI8l000D+OyDH+uwbb4hJ12gpdl2XtzW0Wk7I1uG6vNJ2pcEgG5R8h92qZsPLbN6X27Jq5CXnwcbQx8BlNL5+f8Vt/pwj6BrhHYHB1oH0uG/7JxFQeaXAZ0D4x9leV6JxuNYEJxCQ763yodKHnOypzj5P/VFXywkh2vKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715805110; c=relaxed/simple; bh=22SjqVIynJart/aAQzSdbyAP5JKYJX72JKgCtH6p768=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=RaaYdEz55DBxcTmTAE31gbpB44RQrvYjCa5BbcySS66SWhRIkWZIOkPhAp4IuE0PLri598l9AZb/qLa2Otblc0CQawUxUP2A4o9cA84Vcuv4T/FTAxZWAfUpE/cKcS0LObaLSdD1vR2+WmpPyFsYkxlg7sW/1fpSer5xVzvHHmo= 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=1715805108; x=1747341108; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=22SjqVIynJart/aAQzSdbyAP5JKYJX72JKgCtH6p768=; b=TNExJTquAlbKQyLdc1Xmz2w9fOZ6VcFgZ9qU0mdyTg5CT0b7glP4KOll pNdwIWug2eLmKZ9s5NXJaj+iVWS2UHMLomYjON58Db6SLzNhE8PorA5gQ ydV+InJDSFOQFcmGajkfMhRUE2DEJv/n+D2pR6RTq2YJx1Esv2ZJ3Luce 9ygUdqtYhL6sNmpeRa9sNOLKwiQr9MRe6UAs/QfBiHsVBk3zwEV7QsPjB p3tq3SH9Z6peXBdIf3N3XpxHddzuaFr4EOPRH9QLogHVDzt+3P7zTajVP Gaju0Z/eP6tmN/0/H/+pg0Lw9SgMAE8rnUuZPoMYDnRZO//NMV5zLGPoh A==; X-CSE-ConnectionGUID: XOEK6DVCR3anU9gW5mrhTA== X-CSE-MsgGUID: sDS+odRRQImNZAtS+hT+yQ== X-IronPort-AV: E=McAfee;i="6600,9927,11074"; a="15704269" X-IronPort-AV: E=Sophos;i="6.08,162,1712646000"; d="scan'208";a="15704269" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2024 13:31:47 -0700 X-CSE-ConnectionGUID: 57suM3xqTJyeOB369TfxYw== X-CSE-MsgGUID: nj2et7hPTLSA69O7KQIxNw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,162,1712646000"; d="scan'208";a="35956729" Received: from abijaz-mobl2.ger.corp.intel.com (HELO localhost) ([10.246.42.1]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2024 13:31:45 -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, tom@tromey.com Subject: [PATCH v3 1/1] gdb, testsuite: Handle unused compiler option fdiagnostics-color=never. Date: Wed, 15 May 2024 22:31:28 +0200 Message-Id: <20240515203128.3186-1-abdul.b.ijaz@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 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. This problem is not seen for the ".S" assembly source files so these files are not handled separately. 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 (.s): ''' 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 | 54 +++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 0d78691c381..aea0ba599c7 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,13 @@ 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] + # icx/clang compilers support the -fdiagnostics-color option for + # ".S" files and only it is not supported for ".s" files. + 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.