Chromium Code Reviews| Index: base/android/jni_generator/jni_generator.py |
| diff --git a/base/android/jni_generator/jni_generator.py b/base/android/jni_generator/jni_generator.py |
| index 4c58be2a94e8c51e77fa0d95fd68b4958fd028fe..0cb70bc836b379f4bf333c4219e78ef0a858f95f 100755 |
| --- a/base/android/jni_generator/jni_generator.py |
| +++ b/base/android/jni_generator/jni_generator.py |
| @@ -848,7 +848,14 @@ ${NATIVES} |
| 'EARLY_EXIT': early_exit, |
| 'NATIVES': natives, |
| } |
| - return template.substitute(values) |
| + |
| + func_declaration = '' |
| + if not natives: |
| + func_declaration = Template("""\ |
| +${REGISTER_NATIVES_SIGNATURE} __attribute__((unused)); |
|
no sievers
2016/08/01 21:42:41
This can only be used on the declaration, not the
Torne
2016/08/02 12:23:13
Yeah attributes are annoying :)
|
| +""").substitute(values) |
| + |
| + return func_declaration + template.substitute(values) |
| def GetRegisterNativesImplString(self): |
| """Returns the shared implementation for RegisterNatives.""" |
| @@ -1101,7 +1108,6 @@ ${FUNCTION_SIGNATURE} {""") |
| template = Template(""" |
| static base::subtle::AtomicWord g_${JAVA_CLASS}_${METHOD_ID_VAR_NAME} = 0; |
| ${FUNCTION_HEADER} |
| - /* Must call RegisterNativesImpl() */ |
| CHECK_CLAZZ(env, ${FIRST_PARAM_IN_CALL}, |
| ${JAVA_CLASS}_clazz(env)${OPTIONAL_ERROR_RETURN}); |
| jmethodID method_id = |