Xcode complains about Unused functions that are used

Duck

I have a "MyConstants.h" file that is imported by several classes.

Inside that file I have things like:

static BOOL isIndexValid(NSInteger index) {
  return ((index >=0) && (index < 200));
}

This function is extensively used by the classes importing MyConstants.h. Even so, Xcode complains that this function and others are not used.

Why?

Droppy

Defining a static function (or variable, for that matter) in a header file means every source file that imports that header file will get its own copy.

That is not good and is what the compiler is complaining about (not every source file references this function).

Make it static inline instead:

static inline BOOL isIndexValid(NSInteger index) {
  return ((index >=0) && (index < 200));
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

cppcheck complains about unreadVariable when used in template

From Dev

Xcode complains about structure of if-statement using Swift and Xcode 6

From Dev

Testflight complains about developer certificate being used to sign the app

From Dev

Xcode complains about a non-decodeable instance of a view

From Dev

Compiler complains that 'Expression resolved to unused function' when removing index in array of functions

From Dev

Make Perl warn me about missing unused functions

From Dev

KDB+/Q: About unused parameters in inner functions

From Dev

Make Perl warn me about missing unused functions

From Dev

What does the Xcode 5 build setting "Unused Functions" actually do?

From Dev

PHPUnit complains about Selenium

From Dev

PHPUnit complains about Selenium

From Dev

Gradle complains about bracket

From Dev

fltk complains about gcc on windows

From Dev

Linker complains about missing -fPIC

From Dev

g++-5.1.1 warns about unused variable only when optimization flag is used

From Dev

How to disable Xcode compiler warning "Property access result unused - getters should not be used for side effects"

From Dev

Correct way to suppress Xcode's unused function warning for inline functions in library header

From Dev

split now complains about missing "isSeparator"

From Dev

embedFonts complains about “Unknown device: pswrite”

From Dev

Aida Web install complains about missing "SecureHashAlgorithm"

From Dev

GHC complains about overlapping instances when in fact they are not

From Dev

PyCharm complains about patch.object but why?

From Dev

Spyder complains about some basic commands

From Dev

ggplot complains about applying code to the data

From Dev

Juicy Pixels complains about not having enough memory

From Dev

Doxygen complains about recursive C++ class

From Dev

Stringer tool complains about wrong archive header

From Dev

Why Netbeans complains about "incorrect credentials" with Git?

From Dev

Tuple struct constructor complains about private fields

Related Related

  1. 1

    cppcheck complains about unreadVariable when used in template

  2. 2

    Xcode complains about structure of if-statement using Swift and Xcode 6

  3. 3

    Testflight complains about developer certificate being used to sign the app

  4. 4

    Xcode complains about a non-decodeable instance of a view

  5. 5

    Compiler complains that 'Expression resolved to unused function' when removing index in array of functions

  6. 6

    Make Perl warn me about missing unused functions

  7. 7

    KDB+/Q: About unused parameters in inner functions

  8. 8

    Make Perl warn me about missing unused functions

  9. 9

    What does the Xcode 5 build setting "Unused Functions" actually do?

  10. 10

    PHPUnit complains about Selenium

  11. 11

    PHPUnit complains about Selenium

  12. 12

    Gradle complains about bracket

  13. 13

    fltk complains about gcc on windows

  14. 14

    Linker complains about missing -fPIC

  15. 15

    g++-5.1.1 warns about unused variable only when optimization flag is used

  16. 16

    How to disable Xcode compiler warning "Property access result unused - getters should not be used for side effects"

  17. 17

    Correct way to suppress Xcode's unused function warning for inline functions in library header

  18. 18

    split now complains about missing "isSeparator"

  19. 19

    embedFonts complains about “Unknown device: pswrite”

  20. 20

    Aida Web install complains about missing "SecureHashAlgorithm"

  21. 21

    GHC complains about overlapping instances when in fact they are not

  22. 22

    PyCharm complains about patch.object but why?

  23. 23

    Spyder complains about some basic commands

  24. 24

    ggplot complains about applying code to the data

  25. 25

    Juicy Pixels complains about not having enough memory

  26. 26

    Doxygen complains about recursive C++ class

  27. 27

    Stringer tool complains about wrong archive header

  28. 28

    Why Netbeans complains about "incorrect credentials" with Git?

  29. 29

    Tuple struct constructor complains about private fields

HotTag

Archive