public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* sys/cdefs.h or maybe gcc build issue
@ 2016-10-30 18:37 cyg Simple
  2016-10-30 21:33 ` Brian Inglis
  2016-11-01 19:42 ` Ken Brown
  0 siblings, 2 replies; 7+ messages in thread
From: cyg Simple @ 2016-10-30 18:37 UTC (permalink / raw)
  To: cygwin

The below sample code will give a warning that visibility isn't
supported in this configuration.  Either the GCC build is incorrect or
the sys/cdefs.h needs to be modified to define __hidden to empty.

/********************************************/
#include <sys/cdefs.h>
#include <stdio.h>

__hidden void hello (char * str) {
	printf("%s %s\n", "Hello", str);
}

int main (int argc, char ** argv) {
	hello("cruel world!");
}
/********************************************/

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: sys/cdefs.h or maybe gcc build issue
  2016-10-30 18:37 sys/cdefs.h or maybe gcc build issue cyg Simple
@ 2016-10-30 21:33 ` Brian Inglis
  2016-10-31 11:05   ` cyg Simple
  2016-11-01 19:42 ` Ken Brown
  1 sibling, 1 reply; 7+ messages in thread
From: Brian Inglis @ 2016-10-30 21:33 UTC (permalink / raw)
  To: cygwin

On 2016-10-30 12:23, cyg Simple wrote:
> The below sample code will give a warning that visibility isn't
> supported in this configuration.  Either the GCC build is incorrect or
> the sys/cdefs.h needs to be modified to define __hidden to empty.

https://cygwin.com/ml/cygwin/2005-08/msg01057.html

gcc wiki demonstrates what needs to be done instead:

https://gcc.gnu.org/wiki/Visibility#line-76

at a minimum add `&& !define(__CYGWIN__)`; other posts also exclude
MinGW and ARM-PE (W10 Surface, IoT) targets using PE format not ELF;
gcc notes not all ELF targets support this:
  
https://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/Function-Attributes.html#index-_0040code_007bvisibility_007d-attribute-1624

Which raises the interesting question - anyone tried porting Cygwin
to non-x86 arch?

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: sys/cdefs.h or maybe gcc build issue
  2016-10-30 21:33 ` Brian Inglis
@ 2016-10-31 11:05   ` cyg Simple
  0 siblings, 0 replies; 7+ messages in thread
From: cyg Simple @ 2016-10-31 11:05 UTC (permalink / raw)
  To: cygwin

On 10/30/2016 5:09 PM, Brian Inglis wrote:
> On 2016-10-30 12:23, cyg Simple wrote:
>> The below sample code will give a warning that visibility isn't
>> supported in this configuration.  Either the GCC build is incorrect or
>> the sys/cdefs.h needs to be modified to define __hidden to empty.
> 
> https://cygwin.com/ml/cygwin/2005-08/msg01057.html
> 

I figured that out but that means sys/cdefs.h as delivered needs to ...

> gcc wiki demonstrates what needs to be done instead:
> 
> https://gcc.gnu.org/wiki/Visibility#line-76
> 
> at a minimum add `&& !define(__CYGWIN__)`; other posts also exclude

consider this and define __hidden and other visibility helper macros as
empty.

> MinGW and ARM-PE (W10 Surface, IoT) targets using PE format not ELF;
> gcc notes not all ELF targets support this:
>  

If others deliver a sys/cdefs.h then it should at least declare these
helper macros as empty but that isn't for this list.

> https://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/Function-Attributes.html#index-_0040code_007bvisibility_007d-attribute-1624
> 
> 
> Which raises the interesting question - anyone tried porting Cygwin
> to non-x86 arch?
> 

Maybe but I don't know.

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: sys/cdefs.h or maybe gcc build issue
  2016-10-30 18:37 sys/cdefs.h or maybe gcc build issue cyg Simple
  2016-10-30 21:33 ` Brian Inglis
@ 2016-11-01 19:42 ` Ken Brown
  2016-11-02  2:29   ` cyg Simple
  1 sibling, 1 reply; 7+ messages in thread
From: Ken Brown @ 2016-11-01 19:42 UTC (permalink / raw)
  To: cygwin

On 10/30/2016 2:23 PM, cyg Simple wrote:
> The below sample code will give a warning that visibility isn't
> supported in this configuration.  Either the GCC build is incorrect or
> the sys/cdefs.h needs to be modified to define __hidden to empty.
>
> /********************************************/
> #include <sys/cdefs.h>
> #include <stdio.h>
>
> __hidden void hello (char * str) {
> 	printf("%s %s\n", "Hello", str);
> }
>
> int main (int argc, char ** argv) {
> 	hello("cruel world!");
> }
> /********************************************/

If you're trying to write portable code, why would you assume that 
__hidden is defined?  It's not defined in glibc, for example, and your 
sample program doesn't compile on Linux:

$ gcc test.c
test.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before 
‘void’

Do you have a real use case where this issue came up?  The sample isn't 
very convincing as it stands.

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: sys/cdefs.h or maybe gcc build issue
  2016-11-01 19:42 ` Ken Brown
@ 2016-11-02  2:29   ` cyg Simple
  2016-11-08 15:17     ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: cyg Simple @ 2016-11-02  2:29 UTC (permalink / raw)
  To: cygwin

On 11/1/2016 3:42 PM, Ken Brown wrote:
> On 10/30/2016 2:23 PM, cyg Simple wrote:
>> The below sample code will give a warning that visibility isn't
>> supported in this configuration.  Either the GCC build is incorrect or
>> the sys/cdefs.h needs to be modified to define __hidden to empty.
>>
>> /********************************************/
>> #include <sys/cdefs.h>
>> #include <stdio.h>
>>
>> __hidden void hello (char * str) {
>>     printf("%s %s\n", "Hello", str);
>> }
>>
>> int main (int argc, char ** argv) {
>>     hello("cruel world!");
>> }
>> /********************************************/
> 
> If you're trying to write portable code, why would you assume that
> __hidden is defined?  It's not defined in glibc, for example, and your
> sample program doesn't compile on Linux:
> 
> $ gcc test.c
> test.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
> ‘void’
> 
> Do you have a real use case where this issue came up?  The sample isn't
> very convincing as it stands.

I don't in the real case sense but in Cygwin __hidden is defined.  And
obviously it is incorrectly defined in _YOUR_ Linux.  If the visibility
attribute isn't supported by the GCC compiler these helper macros
shouldn't be defined as if they were.

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: sys/cdefs.h or maybe gcc build issue
  2016-11-02  2:29   ` cyg Simple
@ 2016-11-08 15:17     ` Corinna Vinschen
  2016-11-09  2:09       ` cyg Simple
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2016-11-08 15:17 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]

On Nov  1 22:29, cyg Simple wrote:
> On 11/1/2016 3:42 PM, Ken Brown wrote:
> > On 10/30/2016 2:23 PM, cyg Simple wrote:
> >> The below sample code will give a warning that visibility isn't
> >> supported in this configuration.  Either the GCC build is incorrect or
> >> the sys/cdefs.h needs to be modified to define __hidden to empty.
> >>
> >> /********************************************/
> >> #include <sys/cdefs.h>
> >> #include <stdio.h>
> >>
> >> __hidden void hello (char * str) {
> >>     printf("%s %s\n", "Hello", str);
> >> }
> >>
> >> int main (int argc, char ** argv) {
> >>     hello("cruel world!");
> >> }
> >> /********************************************/
> > 
> > If you're trying to write portable code, why would you assume that
> > __hidden is defined?  It's not defined in glibc, for example, and your
> > sample program doesn't compile on Linux:
> > 
> > $ gcc test.c
> > test.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
> > ‘void’
> > 
> > Do you have a real use case where this issue came up?  The sample isn't
> > very convincing as it stands.
> 
> I don't in the real case sense but in Cygwin __hidden is defined.  And
> obviously it is incorrectly defined in _YOUR_ Linux.  If the visibility
> attribute isn't supported by the GCC compiler these helper macros
> shouldn't be defined as if they were.

Fixed in the repo.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: sys/cdefs.h or maybe gcc build issue
  2016-11-08 15:17     ` Corinna Vinschen
@ 2016-11-09  2:09       ` cyg Simple
  0 siblings, 0 replies; 7+ messages in thread
From: cyg Simple @ 2016-11-09  2:09 UTC (permalink / raw)
  To: cygwin

On 11/8/2016 10:17 AM, Corinna Vinschen wrote:
> On Nov  1 22:29, cyg Simple wrote:
>> On 11/1/2016 3:42 PM, Ken Brown wrote:
>>> On 10/30/2016 2:23 PM, cyg Simple wrote:
>>>> The below sample code will give a warning that visibility isn't
>>>> supported in this configuration.  Either the GCC build is incorrect or
>>>> the sys/cdefs.h needs to be modified to define __hidden to empty.
>>>>
>>>> /********************************************/
>>>> #include <sys/cdefs.h>
>>>> #include <stdio.h>
>>>>
>>>> __hidden void hello (char * str) {
>>>>     printf("%s %s\n", "Hello", str);
>>>> }
>>>>
>>>> int main (int argc, char ** argv) {
>>>>     hello("cruel world!");
>>>> }
>>>> /********************************************/
>>>
>>> If you're trying to write portable code, why would you assume that
>>> __hidden is defined?  It's not defined in glibc, for example, and your
>>> sample program doesn't compile on Linux:
>>>
>>> $ gcc test.c
>>> test.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
>>> ‘void’
>>>
>>> Do you have a real use case where this issue came up?  The sample isn't
>>> very convincing as it stands.
>>
>> I don't in the real case sense but in Cygwin __hidden is defined.  And
>> obviously it is incorrectly defined in _YOUR_ Linux.  If the visibility
>> attribute isn't supported by the GCC compiler these helper macros
>> shouldn't be defined as if they were.
> 
> Fixed in the repo.
> 

Thanks, in a few months I can remove my #ifdef __CYGWIN__ to #undef and
#define it.

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-11-09  2:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-30 18:37 sys/cdefs.h or maybe gcc build issue cyg Simple
2016-10-30 21:33 ` Brian Inglis
2016-10-31 11:05   ` cyg Simple
2016-11-01 19:42 ` Ken Brown
2016-11-02  2:29   ` cyg Simple
2016-11-08 15:17     ` Corinna Vinschen
2016-11-09  2:09       ` cyg Simple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).