more [[gnu::...]] attributes

This commit is contained in:
Max Kellermann
2021-10-13 11:28:04 +02:00
parent 1c4b484a56
commit f510564d9d
135 changed files with 361 additions and 514 deletions

View File

@ -48,10 +48,10 @@ class File : public LocalObject {
public:
using LocalObject::LocalObject;
gcc_nonnull_all
[[gnu::nonnull]]
static void Initialise(JNIEnv *env) noexcept;
gcc_nonnull_all
[[gnu::nonnull]]
static jstring GetAbsolutePath(JNIEnv *env, jobject file) noexcept {
return (jstring)env->CallObjectMethod(file,
getAbsolutePath_method);
@ -69,7 +69,7 @@ public:
* Invoke File.getAbsolutePath() and release the
* specified File reference.
*/
gcc_pure gcc_nonnull_all
[[gnu::pure]] [[gnu::nonnull]]
static AllocatedPath ToAbsolutePath(JNIEnv *env,
jobject file) noexcept;
};

View File

@ -30,8 +30,6 @@
#ifndef JAVA_GLOBAL_HXX
#define JAVA_GLOBAL_HXX
#include "util/Compiler.h"
#include <jni.h>
namespace Java {
@ -47,8 +45,9 @@ DetachCurrentThread() noexcept
jvm->DetachCurrentThread();
}
static inline gcc_pure
JNIEnv *GetEnv() noexcept
[[gnu::pure]]
static inline JNIEnv *
GetEnv() noexcept
{
JNIEnv *env;
jvm->AttachCurrentThread(&env, nullptr);