[Asterisk-code-review] Produce friendly error when AST MODULE SELF SYM is not defined. (asterisk[14])

Anonymous Coward asteriskteam at digium.com
Tue Aug 9 19:09:36 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: Produce friendly error when AST_MODULE_SELF_SYM is not defined.
......................................................................


Produce friendly error when AST_MODULE_SELF_SYM is not defined.

Modules must define AST_MODULE_SELF_SYM to be used as the name of a
generated function.  This produces a friendly error when it's not
defined.

ASTERISK-26278 #close

Change-Id: Ib9d35a08104529c516d636771365e02c6e77a45b
---
M codecs/lpc10/Makefile
M include/asterisk.h
M main/Makefile
3 files changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved



diff --git a/codecs/lpc10/Makefile b/codecs/lpc10/Makefile
index bdf1a3a..b414fd7 100644
--- a/codecs/lpc10/Makefile
+++ b/codecs/lpc10/Makefile
@@ -25,7 +25,7 @@
 
 # The code here generates lots of warnings, so compiling with -Werror
 # fails miserably. Remove it for the time being.
-_ASTCFLAGS:=$(_ASTCFLAGS:-Werror=)
+_ASTCFLAGS:=$(_ASTCFLAGS:-Werror=) -DAST_MODULE_SELF_SYM=__internal_codec_lpc10_self
 
 LIB = $(LIB_TARGET_DIR)/liblpc10.a
 
diff --git a/include/asterisk.h b/include/asterisk.h
index e509fbc..93c7cfb 100644
--- a/include/asterisk.h
+++ b/include/asterisk.h
@@ -286,6 +286,10 @@
 /* Internal/forward declaration, AST_MODULE_SELF should be used instead. */
 struct ast_module *AST_MODULE_SELF_SYM(void);
 
+#else
+
+#error "Externally compiled modules must declare AST_MODULE_SELF_SYM."
+
 #endif
 
 /*!
diff --git a/main/Makefile b/main/Makefile
index 729ae9c..663508a 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -284,7 +284,7 @@
 endif
 
 $(ASTPJ_LIB).$(ASTPJ_SO_VERSION): _ASTLDFLAGS+=-Wl,-soname=$(ASTPJ_LIB) $(PJ_LDFLAGS)
-$(ASTPJ_LIB).$(ASTPJ_SO_VERSION): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskpj\" $(PJ_CFLAGS)
+$(ASTPJ_LIB).$(ASTPJ_SO_VERSION): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskpj\" -DAST_NOT_MODULE $(PJ_CFLAGS)
 $(ASTPJ_LIB).$(ASTPJ_SO_VERSION): LIBS+=$(PJPROJECT_LDLIBS) -lssl -lcrypto -luuid -lm -lrt -lpthread
 ifeq ($(GNU_LD),1)
     $(ASTPJ_LIB).$(ASTPJ_SO_VERSION): SO_SUPPRESS_SYMBOLS=-Wl,--version-script,libasteriskpj.exports,--warn-common

-- 
To view, visit https://gerrit.asterisk.org/3435
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib9d35a08104529c516d636771365e02c6e77a45b
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list