compiler-warnings

Inlining warning

I am getting inlining warnings after compilation in 64 bit Linux machine. The compiler is : gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1 The warnings are : warning: inlining failed in call to ‘list_Cons’: call is unlikely and code size would grow warning: called from here warning: inlining failed in call to ‘list_List’: call is unlikely and cod...

Help with a compiler warning: Initialization from distinct Objective-C type when types match

Here is the function where I get the compiler warning, I can't seem to figure out what is causing it. Any help is appreciated. -(void)displaySelector{ //warning on the following line: InstanceSelectorViewController *controller = [[InstanceSelectorViewController alloc] initWithCreator:self]; [self.navController pushViewContr...

"warning: '<CLASS>'may not respond to '<[-|+]FUNCTION>'" Objective C/Xcode Compiler Warnings

I figured this one out, yet thought it worthy of its own question answer pair. I'm new to Xcode and Objective C, and getting to know its varied eccentricities. For instance, the compiler warning "warning: ''may not respond to '<[-|+]FUNCTION>'" appears when I try to compile the following code, which all appears in my implementation file...

objective-c Derived class may not respond to base class method

Hi, I have derived from a 3rd party class, and when I attempt to call a method in the base class, I get the x may not respond to y compiler warning. How can I remove the warning? Repro: @interface ThirdPartyBaseClass : NSObject {} +(id)build; -(void)doStuff; @end @implementation ThirdPartyBaseClass +(id) build{ return [[[self al...

Xcode Objective-c warnings "creating selector for nonexistent method" with OCUnit (SenTestingKit)

I started getting getting warnings like the following in XCode when trying to write some unit tests with OCUnit (SenTestingKit). warning: creating selector for nonexistent method 'myMethodName1:' warning: creating selector for nonexistent method 'myMethodName2:' ... warning: creating selector for nonexistent method 'release' warning: c...

Specific reason for the following warning

When I compile C code in recent version of gcc, I am getting the following warning: Function is define but not used. What can be the reason for this warning and how can I approach to resolve it? ...

How to get a compiler warning when an IBOutlet is disconnected

How can I have Xcode warn me if an IBOutlet of one of my objects is not hooked up to anything in a NIB? I can check that outlets are connected at runtime by adding assert(ofEveryOutlet); in awakeFromNib or viewDidLoad. But it's not as useful, or reliable, as having the compiler do the checking for me. ...

g++ C++0x enum class Compiler Warnings

I've been refactoring my horrible mess of C++ type-safe psuedo-enums to the new C++0x type-safe enums because they're way more readable. Anyway, I use them in exported classes, so I explicitly mark them to be exported: enum class __attribute__((visibility("default"))) MyEnum : unsigned int { One = 1, Two = 2 }; Compiling thi...

Getting following warning while compiling

warning: passing argument 1 of 'bsearch' makes pointer from integer without a cast and the corresponding code is Parent =bsearch((const size_t)ParentNum, ClauseVector, Size, sizeof(CLAUSE),pcheck_CompareNumberAndClause); the compilar is gcc. here CLAUSE is defined as *CLAUSE. @Paul This following more informati...

warning: 'regparm' attribute directive ignored

REGPARM is defined as: #if __GNUC__ >= 3 #define REGPARM(num) __attribute__((regparm(num))) #else #if defined (_MSC_VER) || defined(__BORLANDC__) #define REGPARM(num) __fastcall #else #define REGPARM(num) #endif #endif There is a lot of warnings: 'regparm' attribute directive ignored. How can I (safely) remove them? Thanks ...

What does this mean: warning: converting from ‘void (ClassName::*)()’ to ‘void (*)()’

I have a member function in a class that has a callback, but the callback isn't strictly neccessary, so it has a default callback, which is empty. It seems to work fine, but I get an annoying warning: warning: converting from ‘void (ClassName::*)()’ to ‘void (*)()’ I'm trying to figure out what it means and how to turn it off (or fix ...

Conditional references in .NET project, possible to get rid of warning?

I have two references to a SQLite assembly, one for 32-bit and one for 64-bit, which looks like this (this is a test project to try to get rid of the warning, don't get hung up on the paths): <Reference Condition=" '$(Platform)' == 'x64' " Include="System.Data.SQLite, Version=1.0.61.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, p...

Compiler warning when passing NSError ** as a method parameter

I've been scratching my head about this for the last 4 hours, trying out all kinds of little experiments, but I can't seem to figure out what's going wrong. Could this be a compiler bug? Test.m: - (id)initWithContentsOfURL:(NSURL *)aURL error:(NSError **)error { if (!(self = [super init])) { return nil; } return sel...

How to prevent C6284 when using CString::Format?

The following code is generating warning C6284 when compiled with /analyze on MSVC 2008 : object passed as parameter '%s' when string is required in call to function. CString strTmp, str; str = L"aaa.txt" strTmp.Format (L"File: %s", str); I'm looking for a nice solution for this that would not require static_cast ...

MSBuild 4 fails to build VS2008 csproj due to 1 compiler warning

We have a VS2008 CS DLL project targeting .NET 3.5. It builds successfully on our CI server when using MSBuild 3.5. When CI is upgraded to use MSBuild 4.0, the same project fails to build, due to 1 warning message: c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1418,9): warning MSB3283: Cannot find wrapper ass...

Avoiding "variable might not have been initialized"

I recently ran across a routine that looks something like this: procedure TMyForm.DoSomething(list: TList<TMyObject>; const flag: boolean); var local: integer; begin if flag then //do something else local := ExpensiveFunctionCallThatCalculatesSomething; //do something else for i := 0 to list.Count do if flag then ...

Delphi disable warnings fails

I have the following code in a Delphi 2007 application: function TBaseCriteriaObject.RecursiveCount( ObjType: TBaseCriteriaObjectClass): integer; var CurObj: TBaseCriteriaObject; begin result := 0; {$WARNINGS OFF} for CurObj in RecursiveChildren(ObjType) do Inc(Result); {$WARNINGS ON} end; Which produces this warning: ...

passing arg2 of 'listFind' from incompatible pointer type

Hello, I've got some problem with my function and don't know how to solve this problem, This is my code: ListResult result=listFind(currentLines, compareBasicLines, &linePrototype); <-here problem compareBasicLines pointer to function int compareBasicLines(ptrLine line1, ptrLine line2){ COMPARE_NUMBER_STRINGS(line1, line2); } ...

Function defined but not used in C

I have following code: static __inline__ LIST list_List(POINTER P) { return list_Cons(P,list_Nil()); } After compilation I got following warning: inlining is unlikely but function size may grow I removed the inline and changed into the following : static LIST list_List(POINTER P) { return list_Cons(P,list_Nil()); } Now ...

Suppressing line specific XCode compiler warnings

Similar to Ben Gottlieb's question, I have a handful of deprecated calls that are bugging me. Is there a way to suppress warnings by line? For instance: if([[UIApplication sharedApplication] respondsToSelector:@selector(setStatusBarHidden:withAnimation:)]) { [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:U...