erlyaws / yaws

Yaws webserver
https://erlyaws.github.io
BSD 3-Clause "New" or "Revised" License
1.28k stars 267 forks source link

Replaced all occurrences of "export_all" with explicit export lists. #305

Closed ningzhang closed 7 years ago

ningzhang commented 7 years ago

Compilation fails when compiling Yaws with the latest Erlang/OTP master branch (Version 20) with the following error message:

compile: warnings being treated as errors
<file>.erl:<line number>: export_all flag enabled - all functions
will be exported

The above problem can be fixed with this patch.

capflam commented 7 years ago

This is quite boring to explicitly export functions in the testsuite modules. Because it is harder to write tests this way. Instead, we can just inhibit the warning for the whole testsuite. Could you confirm that the following patch do the trick ?

diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index b89a3bf..7b484f5 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -17,7 +17,7 @@ EBIN_FILES=$(MODULES:%.erl=$(EBIN_DIR)/%.beam)

 LOG_DIR=@builddir@/logs

-ERLC_FLAGS = $(ERLC_GENERIC_FLAGS) -DSHOW_LOG
+ERLC_FLAGS = $(ERLC_GENERIC_FLAGS) -DSHOW_LOG +nowarn_export_all

 include @top_srcdir@/erlang_deps.mk
ningzhang commented 7 years ago

Sure, I'm on it.

ningzhang commented 7 years ago

These two files also need to be adjusted:

www/code/myappmod.erl
www/shoppingcart/shopcart.erl

Shall we use the +nowarn_export_all flag or an explicit export list?

capflam commented 7 years ago

Good catch. There is also some modules in mail and wiki applications. But for all these ones, I think, an explicit export of all public functions is the best choice. I'll try to push the fix very soon. Many thanks.

ningzhang commented 7 years ago

Cheers!