build warnings in nsJVMAuthTools.cpp when using gcc under Win32

RESOLVED INVALID

Status

Core Graveyard
Java: OJI
RESOLVED INVALID
15 years ago
7 years ago

People

(Reporter: Henrik Gemal, Assigned: Alfred Peng)

Tracking

(Blocks: 1 bug)

Trunk
x86
Windows XP
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
when I build under gcc with win32

c:/mozilla/mozilla/modules/oji/src/nsJVMAuthTools.cpp: In member function
   `virtual nsresult nsJVMAuthTools::Internal::QueryInterface(const nsIID&,
   void**)':
c:/mozilla/mozilla/modules/oji/src/nsJVMAuthTools.cpp:86: warning: invalid
   offsetof from non-POD type `class nsJVMAuthTools'; use pointer to member
   instead
c:/mozilla/mozilla/modules/oji/src/nsJVMAuthTools.cpp: In member function
   `virtual nsrefcnt nsJVMAuthTools::Internal::AddRef()':
c:/mozilla/mozilla/modules/oji/src/nsJVMAuthTools.cpp:86: warning: invalid
   offsetof from non-POD type `class nsJVMAuthTools'; use pointer to member
   instead
c:/mozilla/mozilla/modules/oji/src/nsJVMAuthTools.cpp: In member function
   `virtual nsrefcnt nsJVMAuthTools::Internal::Release()':
c:/mozilla/mozilla/modules/oji/src/nsJVMAuthTools.cpp:86: warning: invalid
   offsetof from non-POD type `class nsJVMAuthTools'; use pointer to member

Updated

15 years ago
Status: NEW → ASSIGNED

Comment 1

15 years ago
I haven't met this warning,
did you see this warning when build nsJVMManager.cpp?

Thanks!

Comment 2

15 years ago
I use VC++6.0,

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
(Reporter)

Comment 3

15 years ago
I see these when I compile under gcc under windows. So no VC++ here.

If I delete "nsJVMAuthTools.o" and type "make" I see these warnings
Summary: build warnings in nsJVMAuthTools.cpp → build warnings in nsJVMAuthTools.cpp when using gcc under Win32

Comment 4

15 years ago
did you see this warning when build nsJVMManager.cpp?

Delete "nsJVMManager.o" and type "make", can you see these warnings?

Thanks!

(Reporter)

Comment 5

15 years ago
after delete "nsJVMManager.o" and "make":

c:/mozilla/mozilla/modules/oji/src/nsJVMManager.cpp: In member function
   `virtual nsresult nsJVMManager::Internal::QueryInterface(const nsIID&,
   void**)':
c:/mozilla/mozilla/modules/oji/src/nsJVMManager.cpp:122: warning: invalid
   offsetof from non-POD type `struct nsJVMManager'; use pointer to member
   instead
c:/mozilla/mozilla/modules/oji/src/nsJVMManager.cpp: In member function
   `virtual nsrefcnt nsJVMManager::Internal::AddRef()':
c:/mozilla/mozilla/modules/oji/src/nsJVMManager.cpp:122: warning: invalid
   offsetof from non-POD type `struct nsJVMManager'; use pointer to member
   instead
c:/mozilla/mozilla/modules/oji/src/nsJVMManager.cpp: In member function
   `virtual nsrefcnt nsJVMManager::Internal::Release()':
c:/mozilla/mozilla/modules/oji/src/nsJVMManager.cpp:122: warning: invalid
   offsetof from non-POD type `struct nsJVMManager'; use pointer to member
   instead
c:/mozilla/mozilla/modules/oji/src/nsJVMManager.cpp: In member function `PRBool

   nsJVMManager::MaybeStartupLiveConnect()':
c:/mozilla/mozilla/modules/oji/src/nsJVMManager.cpp:899: warning: unused
   variable `PRBool registeredLiveConnectFactory'

Updated

15 years ago
Blocks: 187528

Comment 6

15 years ago
->kyle
Assignee: joshua.xia → kyle.yuan
Status: ASSIGNED → NEW

Updated

14 years ago
Blocks: 203303

Comment 7

14 years ago
Ha! I have been trying to find a bug with the word offsetof in the summary.

http://gcc.gnu.org/ml/gcc-prs/2003-01/msg01232.html
http://coding.derkeiler.com/Archive/C_CPP/comp.lang.cpp/2003-11/3069.html

I am seeing these in a lot of places.

There is not much information on the web about this warning, but it seems that
gcc < 3.0 was lax about it, and gcc 3.4 (compared to 3.3) has changed the 
message, which is why we are seeing it now.

So far as I can tell, the main reason to use the offsetof macro in C++ code
is to get the address of a member of an object to pass to a non-C++ 
function (such as legacy C code). Where this is the case then the use
of the offsetof macro should be deprecated and replaced by pointer-to-member.

See http://gcc.gnu.org/ml/gcc/2003-11/msg00289.html

It may be difficult to see which of the warnings require changes to
the code for portability/safety - probably very few as I suspect that
most of these cases are those where although the use of offset is
contrary to the language specification, any reasonable implementation
will give the right answer.

We ought to be sure that all cases where the offsetof will produce
nonsense (where the offset may not be a compile-time constant,
for example), are modified to use the pointer-to-member syntax.

Would patches be considired?

Updated

13 years ago
Assignee: yuanyi21 → pete.zha

Comment 8

12 years ago
mass reassign to Alfred
Assignee: zhayupeng → alfred.peng

Updated

8 years ago
Component: Java: OJI → Java: OJI
Product: Core → Core Graveyard
QA Contact: dsirnapalli → java.oji

Comment 9

7 years ago
This code no longer exists.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.