diff mbox series

[v2] c++: Use in-process client when networking is disabled

Message ID 20221103093748.2671754-1-torbjorn.svensson@foss.st.com
State New
Headers show
Series [v2] c++: Use in-process client when networking is disabled | expand

Commit Message

Torbjorn SVENSSON Nov. 3, 2022, 9:37 a.m. UTC
v1 -> v2:
Updated expression in bad-mapper-3.C

Ok for trunk?

---

Without the patch, the output for bad-mapper-3.C would be:

/src/gcc/gcc/testsuite/g++.dg/modules/bad-mapper-3.C:2:1: error: unknown Compiled Module Interface: no such module

As this line is unexpected, the test case would fail.
The same problem can also be seen for g++.dg/modules/bad-mapper-2.C.

gcc/cp/ChangeLog:

	* mapper-client.cc: Use in-process client when networking is
	disabled.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/bad-mapper-3.C: Update dg-error pattern.

Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree.

Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
 gcc/cp/mapper-client.cc                     | 4 ++++
 gcc/testsuite/g++.dg/modules/bad-mapper-3.C | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Nathan Sidwell Nov. 3, 2022, 1:13 p.m. UTC | #1
On 11/3/22 05:37, Torbjörn SVENSSON wrote:
> v1 -> v2:
> Updated expression in bad-mapper-3.C
> 
> Ok for trunk?
> 
> ---
> 
> Without the patch, the output for bad-mapper-3.C would be:
> 
> /src/gcc/gcc/testsuite/g++.dg/modules/bad-mapper-3.C:2:1: error: unknown Compiled Module Interface: no such module
> 
> As this line is unexpected, the test case would fail.
> The same problem can also be seen for g++.dg/modules/bad-mapper-2.C.
> 
> gcc/cp/ChangeLog:
> 
> 	* mapper-client.cc: Use in-process client when networking is
> 	disabled.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/modules/bad-mapper-3.C: Update dg-error pattern.
> 
> Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree.
> 
> Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
> ---
>   gcc/cp/mapper-client.cc                     | 4 ++++
>   gcc/testsuite/g++.dg/modules/bad-mapper-3.C | 2 +-
>   2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc
> index fe9544b5ba4..4dcb3a03660 100644
> --- a/gcc/cp/mapper-client.cc
> +++ b/gcc/cp/mapper-client.cc
> @@ -227,6 +227,8 @@ module_client::open_module_client (location_t loc, const char *o,
>   		int fd = -1;
>   #if CODY_NETWORKING
>   		fd = Cody::OpenLocal (&errmsg, name.c_str () + 1);
> +#else
> +		errmsg = "CODY_NETWORKING disabled";

CODY_NETWORKING is implementor speak. I think just "disabled" is sufficient here?

>   #endif
>   		if (fd >= 0)
>   		  c = new module_client (fd, fd);
> @@ -254,6 +256,8 @@ module_client::open_module_client (location_t loc, const char *o,
>   			int fd = -1;
>   #if CODY_NETWORKING
>   			fd = Cody::OpenInet6 (&errmsg, name.c_str (), port);
> +#else
> +			errmsg = "CODY_NETWORKING disabled";
>   #endif
>   			name[colon] = ':';
>   
> diff --git a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
> index 9dab332ccb2..c91bb4e260c 100644
> --- a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
> +++ b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
> @@ -1,6 +1,6 @@
>   //  { dg-additional-options "-fmodules-ts -fmodule-mapper=localhost:172477262" }
>   import unique3.bob;
> -// { dg-error {failed connecting mapper 'localhost:172477262'} "" { target *-*-* } 0 }
> +// { dg-error {failed (connecting|CODY_NETWORKING disabled) mapper 'localhost:172477262'} "" { target *-*-* } 0 }
>   // { dg-prune-output "fatal error:" }
>   // { dg-prune-output "failed to read" }
>   // { dg-prune-output "compilation terminated" }
Torbjorn SVENSSON Nov. 3, 2022, 1:48 p.m. UTC | #2
Hello Nathan,

On 2022-11-03 14:13, Nathan Sidwell wrote:
> On 11/3/22 05:37, Torbjörn SVENSSON wrote:
>> v1 -> v2:
>> Updated expression in bad-mapper-3.C
>>
>> Ok for trunk?
>>
>> ---
>>
>> Without the patch, the output for bad-mapper-3.C would be:
>>
>> /src/gcc/gcc/testsuite/g++.dg/modules/bad-mapper-3.C:2:1: error: 
>> unknown Compiled Module Interface: no such module
>>
>> As this line is unexpected, the test case would fail.
>> The same problem can also be seen for g++.dg/modules/bad-mapper-2.C.
>>
>> gcc/cp/ChangeLog:
>>
>>     * mapper-client.cc: Use in-process client when networking is
>>     disabled.
>>
>> gcc/testsuite/ChangeLog:
>>
>>     * g++.dg/modules/bad-mapper-3.C: Update dg-error pattern.
>>
>> Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree.
>>
>> Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
>> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
>> ---
>>   gcc/cp/mapper-client.cc                     | 4 ++++
>>   gcc/testsuite/g++.dg/modules/bad-mapper-3.C | 2 +-
>>   2 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc
>> index fe9544b5ba4..4dcb3a03660 100644
>> --- a/gcc/cp/mapper-client.cc
>> +++ b/gcc/cp/mapper-client.cc
>> @@ -227,6 +227,8 @@ module_client::open_module_client (location_t loc, 
>> const char *o,
>>           int fd = -1;
>>   #if CODY_NETWORKING
>>           fd = Cody::OpenLocal (&errmsg, name.c_str () + 1);
>> +#else
>> +        errmsg = "CODY_NETWORKING disabled";
> 
> CODY_NETWORKING is implementor speak. I think just "disabled" is 
> sufficient here?

Ok for trunk if I change to just "disabled" here and in the other places 
below?

Kind regards,
Torbjörn

> 
>>   #endif
>>           if (fd >= 0)
>>             c = new module_client (fd, fd);
>> @@ -254,6 +256,8 @@ module_client::open_module_client (location_t loc, 
>> const char *o,
>>               int fd = -1;
>>   #if CODY_NETWORKING
>>               fd = Cody::OpenInet6 (&errmsg, name.c_str (), port);
>> +#else
>> +            errmsg = "CODY_NETWORKING disabled";
>>   #endif
>>               name[colon] = ':';
>> diff --git a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C 
>> b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
>> index 9dab332ccb2..c91bb4e260c 100644
>> --- a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
>> +++ b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
>> @@ -1,6 +1,6 @@
>>   //  { dg-additional-options "-fmodules-ts 
>> -fmodule-mapper=localhost:172477262" }
>>   import unique3.bob;
>> -// { dg-error {failed connecting mapper 'localhost:172477262'} "" { 
>> target *-*-* } 0 }
>> +// { dg-error {failed (connecting|CODY_NETWORKING disabled) mapper 
>> 'localhost:172477262'} "" { target *-*-* } 0 }
>>   // { dg-prune-output "fatal error:" }
>>   // { dg-prune-output "failed to read" }
>>   // { dg-prune-output "compilation terminated" }
>
Nathan Sidwell Nov. 3, 2022, 2:09 p.m. UTC | #3
On 11/3/22 09:48, Torbjorn SVENSSON wrote:
> Hello Nathan,
> 
> On 2022-11-03 14:13, Nathan Sidwell wrote:
>> On 11/3/22 05:37, Torbjörn SVENSSON wrote:
>>> v1 -> v2:
>>> Updated expression in bad-mapper-3.C
>>>
>>> Ok for trunk?
>>>
>>> ---
>>>
>>> Without the patch, the output for bad-mapper-3.C would be:
>>>
>>> /src/gcc/gcc/testsuite/g++.dg/modules/bad-mapper-3.C:2:1: error: unknown 
>>> Compiled Module Interface: no such module
>>>
>>> As this line is unexpected, the test case would fail.
>>> The same problem can also be seen for g++.dg/modules/bad-mapper-2.C.
>>>
>>> gcc/cp/ChangeLog:
>>>
>>>     * mapper-client.cc: Use in-process client when networking is
>>>     disabled.
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>>     * g++.dg/modules/bad-mapper-3.C: Update dg-error pattern.
>>>
>>> Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree.
>>>
>>> Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
>>> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
>>> ---
>>>   gcc/cp/mapper-client.cc                     | 4 ++++
>>>   gcc/testsuite/g++.dg/modules/bad-mapper-3.C | 2 +-
>>>   2 files changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc
>>> index fe9544b5ba4..4dcb3a03660 100644
>>> --- a/gcc/cp/mapper-client.cc
>>> +++ b/gcc/cp/mapper-client.cc
>>> @@ -227,6 +227,8 @@ module_client::open_module_client (location_t loc, const 
>>> char *o,
>>>           int fd = -1;
>>>   #if CODY_NETWORKING
>>>           fd = Cody::OpenLocal (&errmsg, name.c_str () + 1);
>>> +#else
>>> +        errmsg = "CODY_NETWORKING disabled";
>>
>> CODY_NETWORKING is implementor speak. I think just "disabled" is sufficient here?
> 
> Ok for trunk if I change to just "disabled" here and in the other places below?

yes, thanks
> 
> Kind regards,
> Torbjörn
> 
>>
>>>   #endif
>>>           if (fd >= 0)
>>>             c = new module_client (fd, fd);
>>> @@ -254,6 +256,8 @@ module_client::open_module_client (location_t loc, const 
>>> char *o,
>>>               int fd = -1;
>>>   #if CODY_NETWORKING
>>>               fd = Cody::OpenInet6 (&errmsg, name.c_str (), port);
>>> +#else
>>> +            errmsg = "CODY_NETWORKING disabled";
>>>   #endif
>>>               name[colon] = ':';
>>> diff --git a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C 
>>> b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
>>> index 9dab332ccb2..c91bb4e260c 100644
>>> --- a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
>>> +++ b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
>>> @@ -1,6 +1,6 @@
>>>   //  { dg-additional-options "-fmodules-ts 
>>> -fmodule-mapper=localhost:172477262" }
>>>   import unique3.bob;
>>> -// { dg-error {failed connecting mapper 'localhost:172477262'} "" { target 
>>> *-*-* } 0 }
>>> +// { dg-error {failed (connecting|CODY_NETWORKING disabled) mapper 
>>> 'localhost:172477262'} "" { target *-*-* } 0 }
>>>   // { dg-prune-output "fatal error:" }
>>>   // { dg-prune-output "failed to read" }
>>>   // { dg-prune-output "compilation terminated" }
>>
Torbjorn SVENSSON Nov. 4, 2022, 7:57 a.m. UTC | #4
On 2022-11-03 15:09, Nathan Sidwell wrote:
> On 11/3/22 09:48, Torbjorn SVENSSON wrote:
>> Hello Nathan,
>>
>> On 2022-11-03 14:13, Nathan Sidwell wrote:
>>> On 11/3/22 05:37, Torbjörn SVENSSON wrote:
>>>> v1 -> v2:
>>>> Updated expression in bad-mapper-3.C
>>>>
>>>> Ok for trunk?
>>>>
>>>> ---
>>>>
>>>> Without the patch, the output for bad-mapper-3.C would be:
>>>>
>>>> /src/gcc/gcc/testsuite/g++.dg/modules/bad-mapper-3.C:2:1: error: 
>>>> unknown Compiled Module Interface: no such module
>>>>
>>>> As this line is unexpected, the test case would fail.
>>>> The same problem can also be seen for g++.dg/modules/bad-mapper-2.C.
>>>>
>>>> gcc/cp/ChangeLog:
>>>>
>>>>     * mapper-client.cc: Use in-process client when networking is
>>>>     disabled.
>>>>
>>>> gcc/testsuite/ChangeLog:
>>>>
>>>>     * g++.dg/modules/bad-mapper-3.C: Update dg-error pattern.
>>>>
>>>> Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree.
>>>>
>>>> Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
>>>> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
>>>> ---
>>>>   gcc/cp/mapper-client.cc                     | 4 ++++
>>>>   gcc/testsuite/g++.dg/modules/bad-mapper-3.C | 2 +-
>>>>   2 files changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc
>>>> index fe9544b5ba4..4dcb3a03660 100644
>>>> --- a/gcc/cp/mapper-client.cc
>>>> +++ b/gcc/cp/mapper-client.cc
>>>> @@ -227,6 +227,8 @@ module_client::open_module_client (location_t 
>>>> loc, const char *o,
>>>>           int fd = -1;
>>>>   #if CODY_NETWORKING
>>>>           fd = Cody::OpenLocal (&errmsg, name.c_str () + 1);
>>>> +#else
>>>> +        errmsg = "CODY_NETWORKING disabled";
>>>
>>> CODY_NETWORKING is implementor speak. I think just "disabled" is 
>>> sufficient here?
>>
>> Ok for trunk if I change to just "disabled" here and in the other 
>> places below?
> 
> yes, thanks
>>
>> Kind regards,
>> Torbjörn
>>
>>>
>>>>   #endif
>>>>           if (fd >= 0)
>>>>             c = new module_client (fd, fd);
>>>> @@ -254,6 +256,8 @@ module_client::open_module_client (location_t 
>>>> loc, const char *o,
>>>>               int fd = -1;
>>>>   #if CODY_NETWORKING
>>>>               fd = Cody::OpenInet6 (&errmsg, name.c_str (), port);
>>>> +#else
>>>> +            errmsg = "CODY_NETWORKING disabled";
>>>>   #endif
>>>>               name[colon] = ':';
>>>> diff --git a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C 
>>>> b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
>>>> index 9dab332ccb2..c91bb4e260c 100644
>>>> --- a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
>>>> +++ b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
>>>> @@ -1,6 +1,6 @@
>>>>   //  { dg-additional-options "-fmodules-ts 
>>>> -fmodule-mapper=localhost:172477262" }
>>>>   import unique3.bob;
>>>> -// { dg-error {failed connecting mapper 'localhost:172477262'} "" { 
>>>> target *-*-* } 0 }
>>>> +// { dg-error {failed (connecting|CODY_NETWORKING disabled) mapper 
>>>> 'localhost:172477262'} "" { target *-*-* } 0 }
>>>>   // { dg-prune-output "fatal error:" }
>>>>   // { dg-prune-output "failed to read" }
>>>>   // { dg-prune-output "compilation terminated" }
>>>
> 

Pushed.
diff mbox series

Patch

diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc
index fe9544b5ba4..4dcb3a03660 100644
--- a/gcc/cp/mapper-client.cc
+++ b/gcc/cp/mapper-client.cc
@@ -227,6 +227,8 @@  module_client::open_module_client (location_t loc, const char *o,
 		int fd = -1;
 #if CODY_NETWORKING
 		fd = Cody::OpenLocal (&errmsg, name.c_str () + 1);
+#else
+		errmsg = "CODY_NETWORKING disabled";
 #endif
 		if (fd >= 0)
 		  c = new module_client (fd, fd);
@@ -254,6 +256,8 @@  module_client::open_module_client (location_t loc, const char *o,
 			int fd = -1;
 #if CODY_NETWORKING
 			fd = Cody::OpenInet6 (&errmsg, name.c_str (), port);
+#else
+			errmsg = "CODY_NETWORKING disabled";
 #endif
 			name[colon] = ':';
 
diff --git a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
index 9dab332ccb2..c91bb4e260c 100644
--- a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
+++ b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C
@@ -1,6 +1,6 @@ 
 //  { dg-additional-options "-fmodules-ts -fmodule-mapper=localhost:172477262" }
 import unique3.bob;
-// { dg-error {failed connecting mapper 'localhost:172477262'} "" { target *-*-* } 0 }
+// { dg-error {failed (connecting|CODY_NETWORKING disabled) mapper 'localhost:172477262'} "" { target *-*-* } 0 }
 // { dg-prune-output "fatal error:" }
 // { dg-prune-output "failed to read" }
 // { dg-prune-output "compilation terminated" }