Compiling on Xcode

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiling on Xcode

Igor Korot
Hi, ALL,
Right now my C Language option on the Xcode 5.1.1 is set to "GNU99".
When using this option I am getting a lot of different warnings like:

Value Conversion Issue
Implicit conversion loses integer precision.

I know its just a warning, but I prefer the code to be compiled clean.
I would guess that I need a change the option to get a clean compile.

Which one I should use?

Thank you.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compiling on Xcode

Simon Slavin-3

On 14 Jul 2016, at 4:43am, Igor Korot <[hidden email]> wrote:

> Right now my C Language option on the Xcode 5.1.1 is set to "GNU99".
> When using this option I am getting a lot of different warnings like:
>
> Value Conversion Issue
> Implicit conversion loses integer precision.

Check the properties for the sqlite3.h and sqlite3.c files and make sure Xcode understands that they're C code.  It has a bad habit of assuming that .c files are C++ or Objective-C files.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compiling on Xcode

Igor Korot
Simon,

On Wed, Jul 13, 2016 at 11:51 PM, Simon Slavin <[hidden email]> wrote:

>
> On 14 Jul 2016, at 4:43am, Igor Korot <[hidden email]> wrote:
>
>> Right now my C Language option on the Xcode 5.1.1 is set to "GNU99".
>> When using this option I am getting a lot of different warnings like:
>>
>> Value Conversion Issue
>> Implicit conversion loses integer precision.
>
> Check the properties for the sqlite3.h and sqlite3.c files and make sure Xcode understands that they're C code.  It has a bad habit of assuming that .c files are C++ or Objective-C files.

When I select sqlite3.c in the Xcode project pane on the left, on the
right in the "Identity and Type" I see:

[quote]
Name: sqlite3.c
Type: Default - C Source
[/quote

Doing the same for sqlite3.h I get:

[quote]
Name: sqlite3.h
Type: Default - C Header
[/quote]

Is there anything else to check?

Thank you.

>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compiling on Xcode

Simon Slavin-3

On 14 Jul 2016, at 12:44pm, Igor Korot <[hidden email]> wrote:

> Is there anything else to check?

No.  Those look correct.  You looked at the right place and it had the right options selected.

Although the SQLite team goes to some lengths to avoid errors which prevent compilation, trying to get rid of every warning generated under every combination of compiler/OS/hardware that SQLite is used for would be a never-ending task.

I looked up the warning messages you're seeing.  They are all harmless to your particular way of working.  They're caused by the fact that different types are different between different compilers, even when running on the same OS and hardware.  For instance, as far as your compiler is concerned, under the 64-bit OS X "unsigned long" is a 64-bit unsigned integer but "int" is a 32-bit integer.

There may be a set of compiler options which get rid of those messages but I'm not an expert on that level and I don't think it matters much anyway.  So I think you can proceed with your setup and expect SQLite to perform without problems.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compiling on Xcode

Igor Korot
On Thu, Jul 14, 2016 at 9:38 AM, Simon Slavin <[hidden email]> wrote:

>
> On 14 Jul 2016, at 12:44pm, Igor Korot <[hidden email]> wrote:
>
>> Is there anything else to check?
>
> No.  Those look correct.  You looked at the right place and it had the right options selected.
>
> Although the SQLite team goes to some lengths to avoid errors which prevent compilation, trying to get rid of every warning generated under every combination of compiler/OS/hardware that SQLite is used for would be a never-ending task.
>
> I looked up the warning messages you're seeing.  They are all harmless to your particular way of working.  They're caused by the fact that different types are different between different compilers, even when running on the same OS and hardware.  For instance, as far as your compiler is concerned, under the 64-bit OS X "unsigned long" is a 64-bit unsigned integer but "int" is a 32-bit integer.
>
> There may be a set of compiler options which get rid of those messages but I'm not an expert on that level and I don't think it matters much anyway.  So I think you can proceed with your setup and expect SQLite to perform without problems.

OK, thx.
There are also other warnings reported, however I'm currently at work
and don't have access to my Mac.

I will post them later to make sure that those are harmless as well.

Thank you.

>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compiling on Xcode

Igor Korot
Simon,
Sorry for the long delay. I was trying to catch up on some other stuff.

On Thu, Jul 14, 2016 at 10:01 AM, Igor Korot <[hidden email]> wrote:

> On Thu, Jul 14, 2016 at 9:38 AM, Simon Slavin <[hidden email]> wrote:
>>
>> On 14 Jul 2016, at 12:44pm, Igor Korot <[hidden email]> wrote:
>>
>>> Is there anything else to check?
>>
>> No.  Those look correct.  You looked at the right place and it had the right options selected.
>>
>> Although the SQLite team goes to some lengths to avoid errors which prevent compilation, trying to get rid of every warning generated under every combination of compiler/OS/hardware that SQLite is used for would be a never-ending task.
>>
>> I looked up the warning messages you're seeing.  They are all harmless to your particular way of working.  They're caused by the fact that different types are different between different compilers, even when running on the same OS and hardware.  For instance, as far as your compiler is concerned, under the 64-bit OS X "unsigned long" is a 64-bit unsigned integer but "int" is a 32-bit integer.
>>
>> There may be a set of compiler options which get rid of those messages but I'm not an expert on that level and I don't think it matters much anyway.  So I think you can proceed with your setup and expect SQLite to perform without problems.
>
> OK, thx.
> There are also other warnings reported, however I'm currently at work
> and don't have access to my Mac.
>
> I will post them later to make sure that those are harmless as well.
>
> Thank you.

So the other warning I am seeing is:

"Ambiguous expansion of macro MIN/MAX"

Can those be safely ignored?

Thank you.

>
>>
>> Simon.
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email]
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compiling on Xcode

Simon Slavin-3

On 23 Jul 2016, at 4:26am, Igor Korot <[hidden email]> wrote:

> "Ambiguous expansion of macro MIN/MAX"

Sorry, I don't recognise this problem.  I would try Googling it.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compiling on Xcode

Igor Korot
Simon et al,

On Sat, Jul 23, 2016 at 2:20 AM, Simon Slavin <[hidden email]> wrote:
>
> On 23 Jul 2016, at 4:26am, Igor Korot <[hidden email]> wrote:
>
>> "Ambiguous expansion of macro MIN/MAX"
>
> Sorry, I don't recognise this problem.  I would try Googling it.

Trying to google I found this:
http://stackoverflow.com/questions/24950240/warnings-with-a-new-xcode-project-using-fmdb-sqlitecipher-and-cocoapods

So it does look like SQLite is trying to define the macro twice, but only
for the OSX..
Anybody else can comment?

Thank you.

>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compiling on Xcode

Lifepillar
 >Hi, ALL,
 >Right now my C Language option on the Xcode 5.1.1 is set to "GNU99".
 >When using this option I am getting a lot of different warnings like:
 >
 >Value Conversion Issue
 >Implicit conversion loses integer precision.
 >
 >I know its just a warning, but I prefer the code to be compiled clean.
 >I would guess that I need a change the option to get a clean compile.
 >
 >Which one I should use?

Hi,
I am resurrecting this old thread, because I recently had a similar
issue and didn't find an answer in this list.

When building sqlite-amalgamation-3210000 using Xcode 9.1 in a newly
created project, I get a few dozen warnings, mostly about value
conversion issues as mentioned above, a few about ambiguous MIN/MAX
macro definitions, unreachable code, possible misuse of comma
operator, and one about a (not C99-compliant) over-length string.

Most warnings are easily seen to be harmless (e.g., unreachable code
depends on compile-time flags, and ambiguous macros likely depend on
merging multiple files into one—but the various macro definitions
are equivalent). Besides, I get the same warnings if I add suitable
-W flags to sqlite-autoconf-3210000's Makefile, which otherwise
builds cleanly. This gives me confidence that the warnings may
indeed be ignored—although I am a bit scared of ignoring “implicit
conversion loses integer precision” warnings: I'd like someone
familiar with the code to confirm that that is no cause of concern.

So, you may silence all the warnings by setting the following items
in the target's build settings:

Apple LLVM 9.0 - Warnings - All Languages
   - Implicit Conversion to 32 Bit Type: No
   - Suspicious Commas: No
   - Unreachable Code: No

Apple LLVM 9.0 - Custom Compiler Flags
   - Other Warning Flags: -Wno-ambiguous-macro -Wno-overlength-strings

To avoid missing potential problems in the rest of your code, I'd
recommend suppressing the warnings only for the Release
configuration and only for the specific target.

Hope this may be helpful to others as well,
Life.


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compiling on Xcode

Jens Alfke-2


> On Nov 24, 2017, at 10:14 AM, Lifepillar <[hidden email]> wrote:
>
> When building sqlite-amalgamation-3210000 using Xcode 9.1 in a newly
> created project, I get a few dozen warnings

Yup, and this is an FAQ. SQLite is very thoroughly tested but the developers do not use compiler warnings.

> To avoid missing potential problems in the rest of your code, I'd
> recommend suppressing the warnings only for the Release
> configuration and only for the specific target.

I recommend building SQLite as a separate static-library target, and linking the library into your app target. That way you can turn off warnings for SQLite without affecting your own code.

—Jens

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users