From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id D4B4B3858404 for ; Wed, 10 Aug 2022 09:30:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D4B4B3858404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9090A2012F; Wed, 10 Aug 2022 09:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1660123807; h=from:from:reply-to: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=2xjKCeAxusmIWDZG7M6OxLjKuKTaVhudtYmSoJDz824=; b=c4qyGsafkWjY2mqz+mRZFwuHjtRGFsL+Wz+EkAKG/gwel07FCBiPmB4h4sAhWdxuqFvGOj d1yuv8+a9VGKmmSKDMnsub41RLHdJqGYVUh+yyIOfuzjBDJ25OkksZuugBX25DeASME++u YruWA2nXvUHly+JCPG8GSbm0xQRPpjY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1660123807; h=from:from:reply-to: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=2xjKCeAxusmIWDZG7M6OxLjKuKTaVhudtYmSoJDz824=; b=LiI3hkQMMVl1QaYEfd+jFqBKnaE/Jhri92sFVrfrpVlwZeONDufJt51H202ctPlzpnM9Rg 4trxABFAWueO/iAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7670113AB3; Wed, 10 Aug 2022 09:30:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wISJG59682IAHwAAMHmgww (envelope-from ); Wed, 10 Aug 2022 09:30:07 +0000 Message-ID: Date: Wed, 10 Aug 2022 11:30:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.0 Subject: Re: [PATCH 1/3] Factor out jobserver_active_p. Content-Language: en-US To: Richard Biener Cc: GCC Patches References: <7b34d4a1-4f34-cffb-8b5f-eb3424ca1049@suse.cz> <82e413fb-d592-3885-9d93-28c717921523@suse.cz> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2022 09:30:10 -0000 On 8/10/22 09:47, Richard Biener wrote: > On Wed, Aug 10, 2022 at 9:17 AM Martin Liška wrote: >> >> On 8/10/22 08:56, Richard Biener wrote: >>> C++ standard library includes have to go through system.h (#define >>> INCLUDE_STRING). >> >> Oh, yeah. That means I need to rely on the flat header files :/ >> >>> >>> Does the API really have to use std::string? >> >> I would like to. My main motivation is std::string::rfind function that >> has no C equivalent (would be rstrstr). > > The old code happily uses strstr though, not worrying about > finding the last instance of --jobserver-auth? Yes, sorry, I forgot to mention that, it's something I was notified by the GNU make developer here: https://savannah.gnu.org/bugs/index.php?57242#comment13 > > Anyway, I'm not going to insist - I just noticed the actual > users use .c_str on the error message and adjusting the > environment for a not working jobserver is done > inconsistently. Since I'm coming from C I was more > expecting sth like > > bool jobserver_active = probe_jobserver (true /* diagnose */); Well, the main problem is that I need to "extra" a bunch of information when parsing the env variable (and each consumer needs something else, so that's why the jobserver_info members). It was very ugly having all these return values being given as params (of pointer type). Martin > > rather than pulling in a class instance from an all-inline > implementation. But hey ;) > > >> >> Martin