public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33660]  New: gettid has not been declared
@ 2007-10-04 18:34 razin at avaya dot com
  2007-10-04 18:35 ` [Bug c++/33660] " razin at avaya dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: razin at avaya dot com @ 2007-10-04 18:34 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

Hello!

Upgraded to gcc 4.2.1 and ran into a following issue:
test case:
#include <iostream>
#include <sstream>
#include <sys/types.h>
#include <linux/unistd.h>
#include <errno.h>
// Declare the gettid syscall.
_syscall0(pid_t, gettid);
int main()
{
        std::cout<<"Test for gettid: "<<std::gettid()<<endl;
        return 0;
}

It works on gcc 3.6. Incluede all the proper header according to man pages, but
compiler returns:
getid.cpp:10: error: ‘gettid’ has not been declared
getid.cpp:10: error: expected constructor, destructor, or type conversion
before ‘;’ token
getid.cpp: In function ‘int main()’:
getid.cpp:16: error: ‘gettid’ was not declared in this scope

Sergey


-- 
           Summary: gettid has not been declared
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: razin at avaya dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33660


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

* [Bug c++/33660] gettid has not been declared
  2007-10-04 18:34 [Bug c++/33660] New: gettid has not been declared razin at avaya dot com
@ 2007-10-04 18:35 ` razin at avaya dot com
  2007-10-04 18:40 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: razin at avaya dot com @ 2007-10-04 18:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from razin at avaya dot com  2007-10-04 18:35 -------
Created an attachment (id=14296)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14296&action=view)
test case


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33660


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

* [Bug c++/33660] gettid has not been declared
  2007-10-04 18:34 [Bug c++/33660] New: gettid has not been declared razin at avaya dot com
  2007-10-04 18:35 ` [Bug c++/33660] " razin at avaya dot com
@ 2007-10-04 18:40 ` pinskia at gcc dot gnu dot org
  2007-10-04 18:41 ` bangerth at dealii dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-10-04 18:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-10-04 18:40 -------
And this is not a bug with GCC or libstdc++ as gettid is an GNU libc extension.

Try using gettid instead of std::gettid.  Doing that and qualifying endl with
std:: allows for this program to compile.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33660


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

* [Bug c++/33660] gettid has not been declared
  2007-10-04 18:34 [Bug c++/33660] New: gettid has not been declared razin at avaya dot com
  2007-10-04 18:35 ` [Bug c++/33660] " razin at avaya dot com
  2007-10-04 18:40 ` pinskia at gcc dot gnu dot org
@ 2007-10-04 18:41 ` bangerth at dealii dot org
  2007-10-04 18:46 ` razin at avaya dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2007-10-04 18:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from bangerth at dealii dot org  2007-10-04 18:41 -------
Why should gettid be in namespace std? It's not a standard C++ function,
so the header file declares it to be in the global namespace.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33660


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

* [Bug c++/33660] gettid has not been declared
  2007-10-04 18:34 [Bug c++/33660] New: gettid has not been declared razin at avaya dot com
                   ` (2 preceding siblings ...)
  2007-10-04 18:41 ` bangerth at dealii dot org
@ 2007-10-04 18:46 ` razin at avaya dot com
  2007-10-04 19:37 ` razin at avaya dot com
  2007-10-04 20:05 ` pcarlini at suse dot de
  5 siblings, 0 replies; 7+ messages in thread
From: razin at avaya dot com @ 2007-10-04 18:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from razin at avaya dot com  2007-10-04 18:46 -------
(In reply to comment #3)
> Why should gettid be in namespace std? It's not a standard C++ function,
> so the header file declares it to be in the global namespace.
> 
> W.
> 

(In reply to comment #3)
> Why should gettid be in namespace std? It's not a standard C++ function,
> so the header file declares it to be in the global namespace.
> 
> W.
> 

Ok. That's just the test. I can remove namespace completely:

#include <sys/types.h>
#include <linux/unistd.h>
#include <errno.h>

int main()
{
        gettid();
        return 0;
}

Same result. Actually I figured it will bring up questions, sor


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33660


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

* [Bug c++/33660] gettid has not been declared
  2007-10-04 18:34 [Bug c++/33660] New: gettid has not been declared razin at avaya dot com
                   ` (3 preceding siblings ...)
  2007-10-04 18:46 ` razin at avaya dot com
@ 2007-10-04 19:37 ` razin at avaya dot com
  2007-10-04 20:05 ` pcarlini at suse dot de
  5 siblings, 0 replies; 7+ messages in thread
From: razin at avaya dot com @ 2007-10-04 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from razin at avaya dot com  2007-10-04 19:37 -------
Ok. That's just the test. I can remove namespace completely:

#include <sys/types.h>
#include <linux/unistd.h>
#include <errno.h>

int main()
{
        gettid();
        return 0;
}

Same result. Actually I figured it will bring up questions, sorry


-- 

razin at avaya dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33660


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

* [Bug c++/33660] gettid has not been declared
  2007-10-04 18:34 [Bug c++/33660] New: gettid has not been declared razin at avaya dot com
                   ` (4 preceding siblings ...)
  2007-10-04 19:37 ` razin at avaya dot com
@ 2007-10-04 20:05 ` pcarlini at suse dot de
  5 siblings, 0 replies; 7+ messages in thread
From: pcarlini at suse dot de @ 2007-10-04 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pcarlini at suse dot de  2007-10-04 20:05 -------
Try asking for help on some Linux mailing list, because gettid is (or was) a
Linux extension, actually. In any case, what is available or not on such system
headers has nothing to do with GCC.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33660


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

end of thread, other threads:[~2007-10-04 20:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-04 18:34 [Bug c++/33660] New: gettid has not been declared razin at avaya dot com
2007-10-04 18:35 ` [Bug c++/33660] " razin at avaya dot com
2007-10-04 18:40 ` pinskia at gcc dot gnu dot org
2007-10-04 18:41 ` bangerth at dealii dot org
2007-10-04 18:46 ` razin at avaya dot com
2007-10-04 19:37 ` razin at avaya dot com
2007-10-04 20:05 ` pcarlini at suse dot de

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).