Coder Social home page Coder Social logo

blacktoppstudios / mezz_staticfoundation Goto Github PK

View Code? Open in Web Editor NEW
2.0 6.0 0.0 947 KB

All of the parts of the Mezzanine that need to be handled prior to the real build, like compiler options and platform detection.

License: GNU General Public License v3.0

C++ 56.73% CMake 9.51% HTML 1.16% CSS 10.75% C 21.86%
mezzanine game-development msvc mingw c-plus-plus

mezz_staticfoundation's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mezz_staticfoundation's Issues

Create a simple compile time string

This needs to be able be able to concatenate strings, checking length, indexing and things required to implement these.

Comparing for equality and streaming would be nice, but are stretch goals

Make it easy to mark functions as Pure

In GCC attribute__((const)) and attribute((pure)) are used to mark functions as depending only their input. Having this information allows compilers to make more aggressive optimizations correctly and more easily.

According to the GCC manual - https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html :

pure
Many functions have no effects except the return value and their return value depends only on the parameters and/or global variables. Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be. These functions should be declared with the attribute pure. For example,

          int square (int) __attribute__ ((pure));

says that the hypothetical function square is safe to call fewer times than the program says.

Some of common examples of pure functions are strlen or memcmp. Interesting non-pure functions are functions with infinite loops or those depending on volatile memory or other system resource, that may change between two consecutive calls (such as feof in a multithreading environment).

The attribute pure is not implemented in GCC versions earlier than 2.96.

Const is just like pure except the function also isn't allowed to dereference pointers it is passed. Here is the manual entry for the const attribute:

const
Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly more strict class than the pure attribute below, since function is not allowed to read global memory.

Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Likewise, a function that calls a non-const function usually must not be const. It does not make sense for a const function to return void.

The attribute const is not implemented in GCC versions earlier than 2.5. An alternative way to declare that a function has no side effects, which works in the current version and in some older versions, is as follows:

          typedef int intfn ();

          extern const intfn square;

This approach does not work in GNU C++ from 2.6.0 on, since the language specifies that the `const' must be attached to the return value.

Most other compilers seem to support GCC attributes including Clang and intel: https://stackoverflow.com/questions/2798188/pure-const-function-attributes-in-different-compilers

I propose that we add two macros for tagging functions PURE for const and PURE_WITH_GLOBAL for pure. Which apply these attributes to functions in compilers that support them and resolve to empty on compilers that don't. We might want to come up with better names before.

Update to Jagati 0.13.1

The new version of the Jagati has a bunch of features to simplify CMakeLists.txt creation. It should be used instead of the old Pre-12 code which requires deeper involvement with the Jagati.

Clean up documentation around Template Parameters (@tparams)

TParams are confusing to people with even moderate knowledge. We need to make an effort to make the docs on these less copypasta and more understandable to those at even new skill level. First target should be the static string.

When this is resolved in this repo, Mezz_Test and Mezz_Foundation should be reviewed as well.

Enhance forcing of 32-bit builds

This only works on gcc compatible compilers and is silently ignored for msvc. This needs to either fail or work as expected on those compilers.

Split documentation out from CMakeLists.txt in Jagati

This will likely include some major Jagati work. The stuff that makes the doxygen generation work should be put in its own repo to make it less depedent on the mezzanine and easier to work, even when using the Mezzanine.

That sounded contradictory... Right now all the logic for the documentation stuff is stored in the Mezz_StaticFoundation CMake. If it were in the Jagati all the important data could be manipulated by Jagati functions and Macros.

Doxygen breadcrumbs poorly formatted in web browsers

When generating doxygen docs the docs work but are poorly formatted. The header produced show the list of bread crumbs in a single vertical line instead of several horizontal rows, see attached screenshot:

image

Here are the steps required to duplicate, starting from the directory with this repo checked out. These were done on an ubuntu 17.10 machine with firefox 57, chromium 63, cmake 3.9.1 and doxygen 1.8.13:

$ cd ../
$ mkdir Mezz_StaticFoundation-build
$ cd Mezz_StaticFoundation-build/
$ cmake ../Mezz_StaticFoundation -GNinja
$ ninja
$ ./StaticFoundation_Tester  # Not required but it is worth noting that all tests passed
$ chromium-browser Doxygen/html/index.html 
$ firefox Doxygen/html/index.html 

Look into other automatic code quality tools.

Codacy does automatic style and linter checks: https://www.codacy.com/

IsItMaintained helps to know if we are ignoring people or if our projects are appropriately active: http://isitmaintained.com/

Coveralls is another tool to help with test coverage: https://coveralls.io/

CII best practices helps with making sure we are keeping project transparency and community visibility: https://bestpractices.coreinfrastructure.org/en

Wandbox has tools to try it online: https://wandbox.org/

If we just want to rack up badges we can also link to our issues, our license too.

Fix Jenkins for this repo

Get Jenkins working again and see what new features can easily be added and what benefits can be had if any for the project and team.

Add Spectre code correction suppression.

Spectre is new class of security vulnerability that can cause data to be read from Cache when it shouldn't be able to be read. Most compilers are automatically correcting code vulnerable to this. These corrections do slow down the code with the fixes.

Video games are generally not privacy sensitive, but some may deal with credit card numbers, passwords and potentially other unforeseen sensitive information. It seems that using these mitigations by default is a good idea. Video games also tend to have performance sensitive loops or other things that might require Spectre mitigation on the hot path.

Some compilers produce warnings when inserting these mitigations. Currently the game developer can suppress Spectre warnings in non-performance critical code with something like the following:

SAVE_WARNING_STATE
SUPPRESS_VC_WARNING(5045)
// Code that needs spectre fixes
RESTORE_WARNING_STATE

The game developer also needs a macro that actually suppresses Spectre mitigations. On platforms and compilers this macro should be empty so the code the game developer's code does need to change and automatically inserts spectre mitigation where required.

https://blogs.msdn.microsoft.com/vcblog/2018/01/15/spectre-mitigations-in-msvc/

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.