public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Suppressing gcc warnings
@ 2001-11-02  5:21 Rene Lanz
  2001-11-02  8:34 ` Rupert Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Rene Lanz @ 2001-11-02  5:21 UTC (permalink / raw)
  To: gcc-help; +Cc: trimmer

Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello,

I am particularily interessted how the following, and in this case unnessesary
warning, can be suppressed:

warning: `class X' only defines a private destructor and has no
> friends 
> example use: a class with reference counting
> class X
> {
> public:
> X();
> int AddRef();
> int Release();
> private:
> ~X();
> }

Thanks,

Rene

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

* RE: Suppressing gcc warnings
  2001-11-02  5:21 Suppressing gcc warnings Rene Lanz
@ 2001-11-02  8:34 ` Rupert Wood
  0 siblings, 0 replies; 3+ messages in thread
From: Rupert Wood @ 2001-11-02  8:34 UTC (permalink / raw)
  To: rene.lanz; +Cc: trimmer, gcc-help

Rene Lanz wrote:

> I am particularily interessted how the following, and in this 
> case unnessesary warning, can be suppressed:
> 
> warning: `class X' only defines a private destructor and has no
> friends 

  -Wno-ctor-dtor-privacy

(although agreed, this might be a generally bogus warning)

Hope that helps,
Rup.

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

* Suppressing gcc warnings
@ 2001-08-22 16:12 Rimmer, Todd
  0 siblings, 0 replies; 3+ messages in thread
From: Rimmer, Todd @ 2001-08-22 16:12 UTC (permalink / raw)
  To: gcc-help

> Hello,
> 	I am presently using the gcc 2.72 and 2.95.2 compilers to
> generate code for an embedded application.  As part of this effort I
> attempting to make the code warning clean.  However I have run into a
> number of warnings which I have been unable to properly suppress
> (short of disabling warnings all together, which I would like to
> avoid).
> 
> Is there a way in gcc to suppress the following warnings.  I would
> especially like to suppress them for the specific lines of code which
> have been verified to be correct.  I have made use of
> __attribute__((unused)) successfully, but have not found a similar
> documented way to suppress the warnings below.
> 
> warning: comparison is always true due to limited range of data type
> example use:
> 	template<class Type>
> 	bool IsPowerOf2(Type value)
> 	{
> 		ASSERT(value >= 0);
> 		// algorithm to determine if value is a power of 2
> 	}
> In the above example, the Type could be int, unsigned, etc.  Hence the
> ASSERT is useful.  However when Type is unsigned, the warning is
> generated.
> 
> warning: cast from pointer to integer of different size
> 	occurs due to casts from pointer to int as part of a logging
> subsystem.
> 	It happens varargs in not available due to underlying
> implementation
> 	in the embedded OS.  I would like to suppress for the line of
> code involved (which happens to be in a macro)
> 
> warning: `class X' only defines a private destructor and has no
> friends 
> example use: a class with reference counting
> 	class X
> 	{
> 		public:
> 			X();
> 			int AddRef();
> 			int Release();
> 		private:
> 			~X();
> 	}
> Singletons (with static methods to Create object and a private
> constructor/destructor) generate similar messages.
> 
> warning: unused parameter 'int x'
> __attribute__((unused)) does not seem to work in the context of
> the parameter list to a function, causes syntax error in 2.95.2
> compiler
> Also tried __unused__.  These do however work for variable
> declaration.
> 	int SomeFunc(int arg1 __attribute__((unused)), int arg2)
> causes syntax errors.  While:
> 	int SomeFunc(int arg1, int arg2)
> 	{
> 		int somevar __attribute__((unused)) = 5;
> 		// more code
> 	}
> works.
> I also tried the old /* ARGSUSED */ lint comment preceeding the
> function to no avail.
> 
> Todd Rimmer
> Staff Software Engineer        InfiniCon Systems
> Voice: 610-205-0130x19         Fax: 610-205-0488
> TRimmer@InfiniConSys.com       www.InfiniConSys.com
> 

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

end of thread, other threads:[~2001-11-13 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-02  5:21 Suppressing gcc warnings Rene Lanz
2001-11-02  8:34 ` Rupert Wood
  -- strict thread matches above, loose matches on Subject: below --
2001-08-22 16:12 Rimmer, Todd

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