[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 9be8b2b 06/14: Use ATTRIBUTE_MAY_ALIAS where alias
From: |
Philipp Stephani |
Subject: |
[Emacs-diffs] master 9be8b2b 06/14: Use ATTRIBUTE_MAY_ALIAS where alias violations are likely |
Date: |
Sun, 4 Jun 2017 13:54:06 -0400 (EDT) |
branch: master
commit 9be8b2bf1d1679e7b60dd7d2dbfef2c68f046938
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>
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.
---
src/dynlib.h | 11 +++++++----
src/emacs-module.c | 2 +-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/dynlib.h b/src/dynlib.h
index 6246c6a..1d53b8e 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 0fb126e..c276eda 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
- [Emacs-diffs] master updated (bd3c6ee -> 2aa8b15), Philipp Stephani, 2017/06/04
- [Emacs-diffs] master db74384 01/14: Remove two FIXMEs that can't be fixed, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master 1839699 02/14: Define helper macro to reduce code duplication, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master 034275e 07/14: ; Small comment fix, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master 3b0080d 03/14: Rework printing of module functions, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master 366e25a 05/14: Simplify interface of dynlib_attr., Philipp Stephani, 2017/06/04
- [Emacs-diffs] master a8a93b1 10/14: Guard against signed integer overflows, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master fb3a9fd 08/14: ; Grammar fix, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master 9be8b2b 06/14: Use ATTRIBUTE_MAY_ALIAS where alias violations are likely,
Philipp Stephani <=
- [Emacs-diffs] master 5497062 09/14: Add a couple more assertions to the module code, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master 27445a8 11/14: Remove an unneeded assertion, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master 2aa8b15 14/14: Remove an unused error symbol, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master d372017 12/14: Use more specific errors for module load failure, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master 045d21c 04/14: Rationalize environment lifetime management functions, Philipp Stephani, 2017/06/04
- [Emacs-diffs] master 66da3f4 13/14: Support quitting in modules, Philipp Stephani, 2017/06/04