Commit graph

51 commits

Author SHA1 Message Date
Hanif Bin Ariffin
4fea536517 Check pointers against nullptr. 2020-06-15 16:20:36 -04:00
Rémi Verschelde
0ed7d3a40a Error macros: Improve style of error messages
Document why the `if (1) {} else ((void)0)` construct is used.
2020-05-15 18:21:14 +02:00
Rémi Verschelde
0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
Juan Linietsky
1bea8e1eac New lightmapper
-Added LocalVector (needed it)
-Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too)
-Fixes and changes all around the place
-Added library for 128 bits fixed point (required for Delaunay3D)
2020-05-10 15:59:09 -03:00
Rémi Verschelde
13a9bfbca7 Style: Harmonize header guards to style guide [Core] 2020-03-25 11:22:19 +01:00
Rémi Verschelde
1c2f2a805d typedefs: Cleanup unused macros and unnecessary checks
We now require a compiler with C++17 support, so we don't need to
check for features added to GCC 5 or Clang 3.2.

Clang builtin availability checks were unused anyway as Clang defines
`__GNUC__` as it's also a GNU C implementation.

Fixes #36986.
2020-03-11 21:44:56 +01:00
Thakee Nathees
08fef074c2 error_macros.h typo fixed 2020-03-04 10:35:31 +05:30
Marcel Admiraal
d2b02a3d7b Remove do{ } while(0) wrapper around error macros.
As pointed out by Faless, a do{ } while(0) wrapper around a continue or
break just ends the do{ } while(0) loop. The do{ } while(0) loop exists
to enable the macro to be used as a function which requires a semicolon.

The alternative approach is to use an if(1) { } else ((void)0) wrapper.
Since the macro already has an if(unlikely(m_cond)) { } this patch simply
adds the else ((void)0) to this if statement instead.

For consistency all the macros have been updated in the same way, and
trailing else warnings corrected. However, the wrappers around ERR_PRINT
and WARN_PRINT were removed, because they generated too many ambiguous
trailing else warnings. They are also single line macros so a wrapper is
not needed.
2020-02-08 11:21:46 +01:00
Marcel Admiraal
677604685d Apply macro documentation from #35521. 2020-02-05 14:53:06 +01:00
Marcel Admiraal
110f4f2dc5 Remove trailing semicolons from do..while wrappers.
- Remove trailing semicolons from ERR_FAIL_INDEX macros.
- Remove trailing semicolons from ERR_FAIL_UNSIGNED_INDEX macros.
- Remove trailing semicolons from CRASH_BAD_INDEX macros.
- Remove trailing semicolons from CRASH_BAD_UNSIGNED_INDEX macros.
2020-02-05 11:19:40 +01:00
Marcel Admiraal
6d69cd40bd Add do..while(0) wrappers to macros without one.
- Add do..while(0) wrapper to ERR_FAIL_NULL macros.
- Add do..while(0) wrapper to ERR_FAIL_COND macros.
- Add do..while(0) wrapper to ERR_CONTINUE macros.
- Add do..while(0) wrapper to ERR_BREAK macros.
- Add do..while(0) wrapper to CRASH_COND macros.
- Add do..while(0) wrapper to ERR_FAIL macros.
- Add do..while(0) wrapper to ERR_PRINT macros.
- Add do..while(0) wrapper to WARN_PRINT macros.
- Add do..while(0) wrapper to WARN_DEPRECATED macros.
- Add do..while(0) wrapper to CRASH_NOW macros.
2020-02-05 11:19:12 +01:00
Marcel Admiraal
f0db13502a Remove duplicate WARN_PRINT macro. 2020-02-05 11:13:24 +01:00
Marcel Admiraal
5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +01:00
Marcel Admiraal
2b1084fab3 Clean up error_macros.h 2020-02-05 11:13:02 +01:00
Hugo Locurcio
37d55ff153
Improve and document error macros
Documentation can be visible in many IDEs by hovering the macro
anywhere it's used.

Error message styling was also tweaked for consistency.
2020-01-24 17:19:57 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Fabio Alessandrelli
0d7409adfb Fix explain message not being stripped in release.
Messages coming from ERR_EXPLAIN / ERR_*_MSG macros used to strip the
error explanation in release builds and was changed in a recent
refactoring.

This commit restores the old behaviour (fixing release builds).
2019-11-13 14:21:32 +01:00
Marcel Admiraal
83069a3c0f Remove ERR_EXPLAIN macros and the scaffolding they needed. 2019-11-11 10:57:00 +01:00
Marcel Admiraal
b7fdac60f1 Send m_msg directly to _err_print_error(). 2019-11-10 08:03:54 +01:00
Marcel Admiraal
24469d9ce4 Remove implicit dependency on String from error_macros.h. 2019-11-06 10:29:53 +01:00
Robin Hübner
8affda0916 implement accompanying error macros that come with an error message, to replace ERR_EXPLAIN usage. 2019-08-08 15:05:59 +02:00
qarmin
4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
Rémi Verschelde
e0574e1d98 Fix typos with codespell
Using codespell 1.15.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
doubleclick
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-05-19 13:10:35 +02:00
follower
bab27547d3
Typo fix: "the function exists" -> "the function exits"
As far as I can tell, the intended word here is "exits" rather than "exists" but it's not 100% clear.

I'm assuming the intention is to express something along the lines of "An index has failed if m_index >=m_size; [if this happens then] the function exits."
2019-03-25 04:02:04 +13:00
Juan Linietsky
3f681b0681 Clean up blend shape support in GLES2 and GLES3. 2019-03-01 16:01:44 -03:00
marxin
7de7f0ef17 Fix all -Wtype-limits warnings. 2019-02-21 19:34:35 +01:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde
277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Juan Linietsky
e0456f7976 Make sure warn deprecated uses a volatile bool (for multithreading) 2018-08-07 12:25:48 -03:00
Rémi Verschelde
43b7ebf0a0 Style: Apply clang-format (5.0) to some missed files 2018-05-31 09:00:37 +02:00
Juan Linietsky
a2f26a96dc Add a macro to deprecate methods 2018-04-18 14:27:26 +02:00
luz.paz
612ab4bbc6 Fix typos with codespell
Found via `codespell -q 3 --skip="./thirdparty,./editor/translations" -I ../godot-word-whitelist.txt`
Whitelist consists of:
```
ang
doubleclick
lod
nd
que
te
unselect
```
2018-02-21 19:46:06 +01:00
Rémi Verschelde
e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde
b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Marcelo Fernandez
a97d7d948b Improved *_FAIL_INDEX error macros to print the index/size 2017-10-22 12:17:41 -03:00
Hein-Pieter van Braam
22358babda Implement Linux-style likely()/unlikely() macros
This implement branch prediction macros likely() and unlikely() like in
Linux. When using these macros please ensure that when you use them the
condition in the branch really is very, very likely or unlikely. Think
90+% of the time. Primarily useful for error checking. (And I implement
these macros for all our error checking macros now)

See this article for more information:
https://kernelnewbies.org/FAQ/LikelyUnlikely

There are more places where these macros may make sense in renderer and
physics engine. Placing them will come in another commit down the line.
2017-09-21 18:28:28 +02:00
Rémi Verschelde
bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Pedro J. Estébanez
211c451890 Implement well-defined handling of unrecoverable errors
Plus the addition of some convenience CRASH_* error macros.
Plus transient avoidance of the flood of warnings emitted by Clang when checking 'this' for NULL.
Plus explanation about the do-while(0) loop in some error macros.
2017-07-05 09:31:44 +02:00
Rémi Verschelde
df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Rémi Verschelde
5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Rémi Verschelde
3f3f5a5359 Merge remote-tracking branch 'origin/gles3' into gles3-on-master
Various merge conflicts have been fixed manually and some mistakes
might have been made - time will tell :)
2017-01-02 21:52:26 +01:00
Rémi Verschelde
c7bc44d5ad Welcome in 2017, dear changelog reader!
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!
2017-01-01 22:03:33 +01:00
Juan Linietsky
1527cf8c0d 2D Shaders are working again using the new syntax, though all is buggy in general 2016-10-10 18:31:01 -03:00
Hubert Jarosz
4a4f247914
remove trailing whitespace 2016-03-09 00:00:52 +01:00
Juan Linietsky
6fc1c3a4d1 Completed the support for plugins! It is not possible to add plugins.
Not all APIs are provided yet, please request whathever you are missing.
Some example plugins are provided in demos/plugins. Just copy them to a folder in your project named addons/ and then enable them from the project settings.
Have fun!
2016-02-27 23:12:27 -03:00
George Marques
5be9ff7b67 Update copyright to 2016 in headers 2016-01-01 11:50:53 -02:00
Juan Linietsky
200b7bb87c -Display on animation editor which keys are invalid and which tracks are unresolved
-Added a tool to clean up unresolved tracks and unused keys
2015-12-05 14:18:22 -03:00
Juan Linietsky
b0aa49accb merged some stuff for okam 2015-09-03 23:24:55 -03:00
Juan Linietsky
fdaa2920eb Updated copyright year in all headers 2015-04-18 14:38:54 -03:00