diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2020-08-01 13:46:57 -0700 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2020-08-05 18:15:31 -0700 |
commit | a4d40792f6b39772197137d7737b3f4daf2022f0 (patch) | |
tree | d7ae826a5af234bc93d7e01b54f3fe464a37216e /gi/repo.cpp | |
parent | a1cf3f6330e9f98421c37a536f4acafc53d5a72a (diff) | |
download | gjs-a4d40792f6b39772197137d7737b3f4daf2022f0.tar.gz |
maint: Use C++17 attributes
Now that we depend on C++17, we can use these attributes that are part
of the language, instead of relying on macros to make them portable.
(GJS_USE still needs to be defined for public header files, which may be
compiled in C.)
Attributes which are new in C++17 are [[maybe_unused]], [[nodiscard]],
and [[fallthrough]].
[skip cpplint] because cpplint doesn't deal with C++ attributes:
https://github.com/google/styleguide/issues/165
Diffstat (limited to 'gi/repo.cpp')
-rw-r--r-- | gi/repo.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gi/repo.cpp b/gi/repo.cpp index af9a7234..18f04568 100644 --- a/gi/repo.cpp +++ b/gi/repo.cpp @@ -491,7 +491,7 @@ gjs_define_info(JSContext *context, return false; break; } - /* fall through */ + [[fallthrough]]; case GI_INFO_TYPE_FLAGS: if (!gjs_define_enumeration(context, in_object, (GIEnumInfo*) info)) @@ -566,12 +566,9 @@ gjs_lookup_namespace_object(JSContext *context, /* Check if an exception's 'name' property is equal to compare_name. Ignores * all errors that might arise. */ -GJS_USE -static bool -error_has_name(JSContext *cx, - JS::HandleValue thrown_value, - JSString *compare_name) -{ +[[nodiscard]] static bool error_has_name(JSContext* cx, + JS::HandleValue thrown_value, + JSString* compare_name) { if (!thrown_value.isObject()) return false; |