Git Product home page Git Product logo

headers's Introduction

Theos

A cross-platform build system for creating iOS,
macOS, Linux, and Windows programs.

HomeInstallationDocumentationGet Help@[email protected]@theosdevDiscord

Contributors


kirb

uroboro

kabiroberai

DHowett

rpetrich

Thanks to the following people for contributing to Theos in the past: Aehmlo, akemin-dayo, ARM64Darwin1820, ArtikusHG, benrosen78, brendonjkding, conradev, coolstar, DavidSkrundz, DGh0st, Diatrus, dlevi309, DuIslingr, elihwyma, eswick, evelyneee, hirakujira, inoahdev, kemmis, lechium, leptos-null, liuxuan30, mstg, Naville, neoighodaro, nin9tyfour, NSExceptional, opa334, PoomSmart, quiprr, r-plus, Rand01ph, ryannair05, sbingner, Shade-Zepheri, supermamon, theiostream, Tyilo, vsnrain

License

See LICENSE.md for licensing information.

headers's People

Contributors

aehmlo avatar akemin-dayo avatar benrosen78 avatar coolstar avatar dlevi309 avatar extbh avatar hirakujira avatar kabiroberai avatar kirb avatar l1ghtmann avatar leptos-null avatar lillieh1000 avatar mostm avatar mstg avatar nsexceptional avatar opa334 avatar poomsmart avatar rand01ph avatar ryannair05 avatar sbingner avatar shade-zepheri avatar uroboro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

headers's Issues

(Objective-)C++ External linkage issues for global constants in PSSpecifier.h

Importing the PSSpecifier.h in (Objective-)c++ context gives the following errors:

...
==> Compiling api/HSWidgetCombinedAdditionalOptionsAndPreferencesViewController.mm (arm64)…
In file included from api/HSWidgetCombinedAdditionalOptionsAndPreferencesViewController.mm:1:
In file included from api/HSWidgetCombinedAdditionalOptionsAndPreferencesViewController.h:3:
In file included from api/HSWidgetPreferencesListController.h:5:
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:6:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSAccessoryKey; // @"accessory"
                ^
                               = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:7:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSActionKey; // @"action"
                ^
                            = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:8:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSAdjustFontSizeToFitWidthKey; // @"adjustFontSizeToFitWidth"
                ^
                                              = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:9:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSAlignmentKey; // @"alignment"
                ^
                               = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:10:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSAppGroupBundleIDKey; // @"appGroupBundleID"
                ^
                                      = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:11:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSAutoCapsKey; // @"autoCaps"
                ^
                              = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:12:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSAutoCorrectionKey; // @"autoCorrection"
                ^
                                    = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:13:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSBestGuesserKey; // @"bestGuess"
                ^
                                 = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:14:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSBundleCustomIconPathKey; // @"icon2"
                ^
                                          = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:15:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSBundleHasBundleIconKey; // @"hasBundleIcon"
                ^
                                         = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:16:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSBundleHasIconKey; // @"hasIcon"
                ^
                                   = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:17:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSBundleIconPathKey; // @"icon"
                ^
                                    = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:18:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSBundleIsControllerKey; // @"isController"
                ^
                                        = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:19:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSBundleOverridePrincipalClassKey; // @"overridePrincipalClass"
                ^
                                                  = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:20:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSBundlePathKey; // @"bundle"
                ^
                                = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:21:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSBundleTintedIconPathKey; // @"tintedIcon"
                ^
                                          = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:22:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSButtonActionKey; // @"buttonAction"
                ^
                                  = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:23:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSCancelKey; // @"cancel"
                ^
                            = 0
/home/dgh0st/theos/vendor/include/Preferences/PSSpecifier.h:24:17: error: default initialization of an object of const type 'NSString *const'
NSString *const PSCellClassKey; // @"cellClass"
                ^
                               = 0
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[3]: *** [/home/dgh0st/theos/makefiles/instance/rules.mk:201: /mnt/c/cygwin64/home/DGh0st/HSWidgets/.theos/obj/debug/arm64/api/HSWidgetCombinedAdditionalOptionsAndPreferencesViewController.mm.770ee366.o] Error 1
...

Notes:
For reference, the errors shown above are while compiling HSWidgets with latest Theos. But the issue is also reproduceable when creating a new empty preference subproject and including PSSpecifier.h in a Objective-c++ file (.mm).

Potential Root Cause:
I think the issue is the way these global constants are defined in PSSpecifier.h.

For C, following is the output after the pre-processor:

...
NSString *const PSAccessoryKey; // @"accessory"
NSString *const PSActionKey; // @"action"
NSString *const PSAdjustFontSizeToFitWidthKey; // @"adjustFontSizeToFitWidth"
...

By default C compiler provides external linkage for all non-static global variables so this works as expected.

For c++ global constants have internal linkage by default so we need the extern "C", which is what the __BEGIN_DECLS is responsible for. However c++ treats extern "C" blocks slightly differently when it comes to variables. According to the c++ standard, this is the difference that it has:

extern "C" int a; // declaration

extern "C" {
    int b; // definition
}

First is considered as declaration only, but second block statement is considered as a definition so the compiler needs to make sure memory will be created for b. If this were a const then it would require a default value. Which is the case for the PSSpecifier.h.

The way to make it not create space for the current translation unit, and ultimately not complain about the initialization, would be to either use:

extern "C" {
    extern int b; //  declaration
}

or

extern "C" int b; // declaration

(both of which are equivalent according to c++ standards)

_Prefix/NullabilityCompat.h file is missing so compile fails

> Making all for tweak Hooker…
==> Preprocessing Tweak.xm…
==> Compiling Tweak.xm (armv7)…
In file included from <built-in>:184:
In file included from <command line>:5:
/opt/kirb/theos/Prefix.pch:6:10: fatal error: '_Prefix/NullabilityCompat.h' file not found
    #import <_Prefix/NullabilityCompat.h>
            ^
1 error generated.
make[3]: *** [.theos/obj/debug/armv7/Tweak.xm.a3e1ec91.o] Error 1
make[2]: *** [.theos/obj/debug/armv7/Hooker.dylib] Error 2
make[1]: *** [internal-library-all_] Error 2
make: *** [Hooker.all.tweak.variables] Error 2`

[Suggestion] Standardize .modulemap vendor location

What are the steps to reproduce this issue?

N/A

What happens?

N/A

What were you expecting to happen?

N/A

Any logs, error output, etc?

Any other comments?

Note: I am not well versed on clang modules/module maps.

Following the merge of the Orion theos/lib pr, half of the module maps provided by Theos will be located in the lib vendor directory while the other half, listed below, will be present in this repo. I believe the libraries corresponding to the various maps in this repo, save for Preferences, are vended by Theos, so it may be worth moving all module maps to the respective directories here or the respective directories in theos/lib for consistency.

./libundirect/module.modulemap
./Preferences/module.modulemap
./libactivator/module.modulemap
./AppList/module.modulemap
./libhooker/module.modulemap
./Flipswitch/module.modulemap
./rocketbootstrap/module.modulemap
./libprefs/module.modulemap

What versions of software are you using?

Operating System:

Toolchain Version:

SDK Version:

Code Style

Per README:

Follow the existing coding style

There are many different styles throughout the headers, even ignoring vendor headers (e.g. openssl).

I believe there should be a more unified, and explicit style.

Examples of different existing styles

Style discussions are sometimes criticized, because developers have different opinions on how code should be formatted, however I mention these three because I've seen issues arise in due to these in particular.

Availability attributions are important, especially for projects such as this one, where private system APIs are sometimes documented. Deciding on an attribution system allows developers to contribute more easily and effectively.

External declarations must be accurate when using C++, to avoid linking errors. Theos used to create ObjC++ source files by default. A unified extern marking system would avoid issues such as FSSwitchState.h missing a C++ linker hint.

Property attributes are very strongly a style choice, but I mention it due to #21 changing these property declarations. It could be bothersome, if someone felt compelled to change them back, or if new changes are made with no property trailing space, and someone else goes to change those.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.