diff options
author | Philipp Stephani <phst@google.com> | 2017-06-04 19:12:23 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2017-06-04 19:50:50 +0200 |
commit | 9be8b2bf1d1679e7b60dd7d2dbfef2c68f046938 (patch) | |
tree | 1bdf7a125dd9d6838559f7379a10b9982d1d3788 | |
parent | 366e25a6d1caa30d8d336ce556f90f9ee46ca531 (diff) | |
download | emacs-9be8b2bf1d1679e7b60dd7d2dbfef2c68f046938.tar.gz emacs-9be8b2bf1d1679e7b60dd7d2dbfef2c68f046938.tar.bz2 emacs-9be8b2bf1d1679e7b60dd7d2dbfef2c68f046938.zip |
Use ATTRIBUTE_MAY_ALIAS where alias violations are likely
In particular, alias violations are likely for the return values of
dlsym(3), which get cast around arbitrarily.
* src/emacs-module.c (Fmodule_load): Use ATTRIBUTE_MAY_ALIAS.
-rw-r--r-- | src/dynlib.h | 11 | ||||
-rw-r--r-- | src/emacs-module.c | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/dynlib.h b/src/dynlib.h index 6246c6a6642..1d53b8e5b2f 100644 --- a/src/dynlib.h +++ b/src/dynlib.h @@ -24,11 +24,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ typedef void *dynlib_handle_ptr; dynlib_handle_ptr dynlib_open (const char *path); -void *dynlib_sym (dynlib_handle_ptr h, const char *sym); -typedef struct dynlib_function_ptr_nonce *(*dynlib_function_ptr) (void); -dynlib_function_ptr dynlib_func (dynlib_handle_ptr h, const char *sym); -const char *dynlib_error (void); int dynlib_close (dynlib_handle_ptr h); +const char *dynlib_error (void); + +ATTRIBUTE_MAY_ALIAS void *dynlib_sym (dynlib_handle_ptr h, const char *sym); + +typedef struct dynlib_function_ptr_nonce *(ATTRIBUTE_MAY_ALIAS *dynlib_function_ptr) (void); +dynlib_function_ptr dynlib_func (dynlib_handle_ptr h, const char *sym); + /* Sets *FILE to the file name from which PTR was loaded, and *SYM to its symbol name. If the file or symbol name could not be determined, set the corresponding argument to NULL. */ diff --git a/src/emacs-module.c b/src/emacs-module.c index 0fb126e61f5..c276edab37b 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -658,7 +658,7 @@ funcall_module (Lisp_Object function, ptrdiff_t nargs, Lisp_Object *arglist) initialize_environment (&pub, &priv); USE_SAFE_ALLOCA; - emacs_value *args; + ATTRIBUTE_MAY_ALIAS emacs_value *args; if (plain_values) args = (emacs_value *) arglist; else |