Re: What is the expected behavior of attribute nonnull for C++

2006-04-28 Thread Mark Mitchell
Steven Bosscher wrote: > That is why I was looking at this. We have http://gcc.gnu.org/PR27336, > and part of the fix could be to make the 'this' pointer always > non-NULL. So far I haven't found anyone who can think of a situation > where 'this' can be NULL... It can't be NULL. (There are ways

Re: What is the expected behavior of attribute nonnull for C++

2006-04-28 Thread Steven Bosscher
On 4/28/06, Mark Mitchell <[EMAIL PROTECTED]> wrote: Steven Bosscher wrote: > The documentation of the nonnull attribute says: > > `nonnull (ARG-INDEX, ...)' > The `nonnull' attribute specifies that some function parameters > should be non-null pointers. For instance, the declaration:

Re: What is the expected behavior of attribute nonnull for C++

2006-04-28 Thread Mark Mitchell
Steven Bosscher wrote: > The documentation of the nonnull attribute says: > > `nonnull (ARG-INDEX, ...)' > The `nonnull' attribute specifies that some function parameters > should be non-null pointers. For instance, the declaration: > > extern void * > my_memcpy (v

What is the expected behavior of attribute nonnull for C++

2006-04-28 Thread Steven Bosscher
Hello, Consider the following test case: struct A { bool g(int*, int*) __attribute__((nonnull (2))); }; bool A::g(int* a, int* b) { if (a) return 0; return this; } G++ produces the following code for this snippet: ;; Function bool A::g(int*, int*) (_ZN1A1gEPiS0_) bool A::g(int*, int*)