From 9b0714b24cb140ea630ea6176ae68b2ec6945c6b Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Fri, 15 Apr 2016 00:07:56 +0300
Subject: [PATCH] py: Declare help, input, open builtins in core.

These are *defined* per-port, but why redeclare them again and again.
---
 cc3200/mpconfigport.h  | 3 ---
 esp8266/mpconfigport.h | 1 -
 py/builtin.h           | 4 ++++
 stmhal/mpconfigport.h  | 3 ---
 teensy/mpconfigport.h  | 3 ---
 unix/mpconfigport.h    | 2 --
 windows/mpconfigport.h | 2 --
 7 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h
index d4774adf3..d3aacc082 100644
--- a/cc3200/mpconfigport.h
+++ b/cc3200/mpconfigport.h
@@ -114,9 +114,6 @@
 #define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE        (0)
 
 // extra built in names to add to the global namespace
-extern const struct _mp_obj_fun_builtin_t mp_builtin_help_obj;
-extern const struct _mp_obj_fun_builtin_t mp_builtin_input_obj;
-extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
 #define MICROPY_PORT_BUILTINS \
     { MP_OBJ_NEW_QSTR(MP_QSTR_help),  (mp_obj_t)&mp_builtin_help_obj },   \
     { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj },  \
diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h
index 4aba68267..577b37398 100644
--- a/esp8266/mpconfigport.h
+++ b/esp8266/mpconfigport.h
@@ -104,7 +104,6 @@ typedef uint32_t sys_prot_t; // for modlwip
 #define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
 
 // extra built in names to add to the global namespace
-extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
 #define MICROPY_PORT_BUILTINS \
     { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
 
diff --git a/py/builtin.h b/py/builtin.h
index 35d8910bd..f63eac73e 100644
--- a/py/builtin.h
+++ b/py/builtin.h
@@ -71,6 +71,10 @@ MP_DECLARE_CONST_FUN_OBJ(mp_builtin_repr_obj);
 MP_DECLARE_CONST_FUN_OBJ(mp_builtin_round_obj);
 MP_DECLARE_CONST_FUN_OBJ(mp_builtin_sorted_obj);
 MP_DECLARE_CONST_FUN_OBJ(mp_builtin_sum_obj);
+// Defined by a port, but declared here for simplicity
+MP_DECLARE_CONST_FUN_OBJ(mp_builtin_help_obj);
+MP_DECLARE_CONST_FUN_OBJ(mp_builtin_input_obj);
+MP_DECLARE_CONST_FUN_OBJ(mp_builtin_open_obj);
 
 MP_DECLARE_CONST_FUN_OBJ(mp_namedtuple_obj);
 
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index 455239db3..6ec92acbf 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -97,9 +97,6 @@
 #define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE  (0)
 
 // extra built in names to add to the global namespace
-extern const struct _mp_obj_fun_builtin_t mp_builtin_help_obj;
-extern const struct _mp_obj_fun_builtin_t mp_builtin_input_obj;
-extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
 #define MICROPY_PORT_BUILTINS \
     { MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
     { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
diff --git a/teensy/mpconfigport.h b/teensy/mpconfigport.h
index 4b2181cdb..867c4e652 100644
--- a/teensy/mpconfigport.h
+++ b/teensy/mpconfigport.h
@@ -27,9 +27,6 @@
 #define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE  (0)
 
 // extra built in names to add to the global namespace
-extern const struct _mp_obj_fun_builtin_t mp_builtin_help_obj;
-extern const struct _mp_obj_fun_builtin_t mp_builtin_input_obj;
-extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
 #define MICROPY_PORT_BUILTINS \
     { MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
     { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h
index 28a7e8b76..abda43258 100644
--- a/unix/mpconfigport.h
+++ b/unix/mpconfigport.h
@@ -259,8 +259,6 @@ void mp_unix_mark_exec(void);
 #endif
 #endif
 
-extern const struct _mp_obj_fun_builtin_t mp_builtin_input_obj;
-extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
 #define MICROPY_PORT_BUILTINS \
     { MP_ROM_QSTR(MP_QSTR_input), MP_ROM_PTR(&mp_builtin_input_obj) }, \
     { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
diff --git a/windows/mpconfigport.h b/windows/mpconfigport.h
index 203aa0449..51d4697e4 100644
--- a/windows/mpconfigport.h
+++ b/windows/mpconfigport.h
@@ -149,8 +149,6 @@ void mp_hal_dupterm_tx_strn(const char *str, size_t len);
 #define mp_hal_dupterm_tx_strn(s, l)
 #endif
 
-extern const struct _mp_obj_fun_builtin_t mp_builtin_input_obj;
-extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
 #define MICROPY_PORT_BUILTINS \
     { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
     { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
-- 
GitLab