From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 8F3833858403 for ; Fri, 26 Aug 2022 14:29:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F3833858403 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 27QETR2t015375 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Aug 2022 10:29:31 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 27QETR2t015375 Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A58FA1E222; Fri, 26 Aug 2022 10:29:26 -0400 (EDT) Message-ID: Date: Fri, 26 Aug 2022 10:29:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] gdb, gdbsupport: configure: factor out yes/no/auto value checking Content-Language: en-US To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Simon Marchi References: <20220817175341.1594352-1-simon.marchi@polymtl.ca> <87zgfubwh6.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87zgfubwh6.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 26 Aug 2022 14:29:27 +0000 X-Spam-Status: No, score=-3032.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2022 14:29:41 -0000 On 2022-08-23 15:17, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> From: Simon Marchi > Simon> Factor out the code that checks that a value is yes/no or yes/no/auto. > Simon> Add two macros to gdbsupport/common.m4 and use them in gdb/configure.ac > > Simon> I inspected the changes to configure. Other than whitespace changes, we > Simon> have some benign changes to the error messages (one of them had an error > Simon> actually). There are changes to the --enable-source-highlight and > Simon> --enable-libbacktrace handling, but setting enable_source_highlight / > Simon> enable_libbacktrace was not really useful anyway, they already had the > Simon> right value. > > This looks reasonable to me. Ok. > Simon> +AC_ARG_ENABLE([gdbmi], > > I was very surprised to learn today that this really can be disabled. I don't really know why that is useful. There is no dependency on any external library, so there's no disadvantage (other than a bit of space saving) of having it enabled. The only real-world usage I could find is in an ancient Builroot version, but it was removed here in 2007: https://github.com/buildroot/buildroot/commit/8759a416c41f8eec02fdb5594275961534ae0c8e#diff-1ba8fa6a02f11bff1ad45de1341ee93aee241a6281298da9ad9721d38246fc91 I just tried a local build with --disable-gdbmi (which has Python implicitly enabled), and I get: /usr/bin/ld: python/py-micmd.o: in function `mi_command_py::invoke(mi_parse*) const': /home/simark/src/binutils-gdb/gdb/python/py-micmd.c:343: undefined reference to `mi_parse_argv(char const*, mi_parse*)' So this new "MI commands in Python feature" should be dependent on whether MI is enabled. But I would also support removing the --disable-gdbmi switch, that would be simpler. > Simon> -AC_ARG_ENABLE(source-highlight, > Simon> - AS_HELP_STRING([--enable-source-highlight], > Simon> - [enable source-highlight for source listings]), > Simon> - [case "${enableval}" in > Simon> - yes) enable_source_highlight=yes ;; > Simon> - no) enable_source_highlight=no ;; > Simon> - *) AC_MSG_ERROR(bad value ${enableval} for source-highlight option) ;; > Simon> -esac], > Simon> -[enable_source_highlight=auto]) > Simon> +AC_ARG_ENABLE([source-highlight], > Simon> + [AS_HELP_STRING([--enable-source-highlight], > Simon> + [enable source-highlight for source listings])], > Simon> + [GDB_CHECK_YES_NO_VAL([$enableval], [--enable-source-highlight])], > Simon> + [enable_source_highlight=auto]) > > This defaults to 'auto' but, weirdly, doesn't let one explicitly specify > 'auto'. I wonder if switching it to GDB_CHECK_YES_NO_AUTO_VAL would be > an improvement. I think that makes sense, I did the change. I will push the patch with that fixed. Thanks, Simon