diff mbox

[1/4] Makefile: adding debug version of sparse

Message ID CANeU7Q=HyZNGXRFydfuxD5KRRwQ-gjMyH4u4OHcmnrttKtFe8A@mail.gmail.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Christopher Li Aug. 13, 2017, 7:08 p.m. UTC
The debug version has the -DSPARSE_DEBUG enabled.
It is intended to include more verification in the
debug version. For now the debug version remain
the same as the release version.

Because the debug version has different compile flags,
all *.o file need to be recompile under the debug flag.
These debug version object file is stored in  debug/
directory.

<name>-dbg is the finial debug version of the
program <name>.

Full compile time is doubled because every thing
needs to compile twice. One for release version.
One for debug version.

Signed-off-by: Christopher Li <sparse@chrisli.org>
---
 Makefile | 38 +++++++++++++++++++++++++++++++++-----
 1 file changed, 33 insertions(+), 5 deletions(-)

 $(warning Your system does not have gtk3/gtk2, disabling test-inspect)
@@ -165,8 +168,13 @@ SED_PC_CMD = 's|@version@|$(VERSION)|g; \
 # Allow users to override build settings without dirtying their trees
 -include local.mk

+DBG_PROGRAMS := $(addprefix debug/, $(addsuffix -dbg, $(PROGRAMS)))
+DBG_LIB_FILE := $(addprefix debug/, $(LIB_FILE))
+DBG_LIB_OBJS := $(addprefix debug/, $(LIB_OBJS))
+DBG_SLIB_FILE := $(addprefix debug/, $(SLIB_FILE))
+DBG_LIBS := $(addprefix debug/, $(LIBS))

-all: $(PROGRAMS) sparse.pc
+all: $(PROGRAMS) $(DBG_PROGRAMS) sparse.pc

 all-installable: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc

@@ -189,14 +197,24 @@ sparse.pc: sparse.pc.in
 compile_EXTRA_DEPS = compile-i386.o

 $(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_EXTRA_DEPS) $(LIBS)))
+$(foreach p,$(PROGRAMS),$(eval debug/$(p)-dbg: $(addprefix debug/,
$($(p)_EXTRA_DEPS)) $(DBG_LIBS)))
+
+
 $(PROGRAMS): % : %.o
  $(QUIET_LINK)$(LD) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS)
+$(DBG_PROGRAMS): debug/%-dbg : debug/%.o
+ $(eval EXTRA := $($(@F:-dbg=)_EXTRA_OBJS))
+ $(QUIET_LINK)$(LD) $(LDFLAGS) -o $@ $^ $(EXTRA)

 $(LIB_FILE): $(LIB_OBJS)
  $(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)
+$(DBG_LIB_FILE): $(DBG_LIB_OBJS)
+ $(QUIET_AR)$(AR) rcs $@ $(DBG_LIB_OBJS)

 $(SLIB_FILE): $(LIB_OBJS)
  $(QUIET_LINK)$(CC) $(LDFLAGS) -Wl,-soname,$@ -shared -o $@ $(LIB_OBJS)
+$(DBG_SLIB_FILE): $(DBG_LIB_OBJS)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) -Wl,-soname,$@ -shared -o $@ $(DBG_LIB_OBJS)

 DEP_FILES := $(wildcard .*.o.d)

@@ -204,21 +222,31 @@ ifneq ($(DEP_FILES),)
 include $(DEP_FILES)
 endif

-c2xml.o c2xml.sc: CFLAGS += $(LIBXML_CFLAGS)
+c2xml.o c2xml.sc debug/c2xml.o debug/c2xml.sc: CFLAGS += $(LIBXML_CFLAGS)

-pre-process.sc: CHECKER_FLAGS += -Wno-vla
+pre-process.sc debug/pre-process.sc: CHECKER_FLAGS += -Wno-vla

+debug:
+ @mkdir debug
+
+debug/%.o: %.c $(LIB_H) | debug
+ $(QUIET_CC)$(CC) -o $@ -c $(DBG_CFLAGS) $<
 %.o: %.c $(LIB_H)
  $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<

+debug/%.sc: %.c sparse
+ $(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) -c $(DBG_CFLAGS) $<
 %.sc: %.c sparse
  $(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) -c $(ALL_CFLAGS) $<

-ALL_OBJS :=  $(LIB_OBJS) $(foreach p,$(PROGRAMS),$(p).o $($(p)_EXTRA_DEPS))
+ALL_OBJS :=  $(LIB_OBJS) $(DBG_LIB_OBJS) \
+ $(foreach p,$(PROGRAMS),$(p).o debug/$(p).o $($(p)_EXTRA_DEPS)
debug/$($(p)_EXTRA_DEPS))
+
 selfcheck: $(ALL_OBJS:.o=.sc)


 clean: clean-check
+ rm -rf debug
  rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc

 dist:

Comments

Luc Van Oostenryck Aug. 13, 2017, 7:31 p.m. UTC | #1
Chris,

The patches you're sending are all whitespace damaged.
Not only these 4 ones the ones you sent before too.

-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li Aug. 13, 2017, 8:14 p.m. UTC | #2
On Sun, Aug 13, 2017 at 3:31 PM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> Chris,
>
> The patches you're sending are all whitespace damaged.
> Not only these 4 ones the ones you sent before too.

Yes, gmail tend to damage white space. That is why I send
attachment before.

I can give a git link if that helps. On my chrisl repo,

git.kernel.org/pub/scm/devel/sparse/chrisl/sparse.git debug-target

I can always give link in the email if you prefer.
I don't seems to have a good way to fix gmail not damaging
the white space. I am already using the text mode.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck Aug. 13, 2017, 8:19 p.m. UTC | #3
On Sun, Aug 13, 2017 at 10:14 PM, Christopher Li <sparse@chrisli.org> wrote:
>
> Yes, gmail tend to damage white space. That is why I send
> attachment before.

git send-email --to=... [--cc=...] <patches formatted by git format-patch>
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li Aug. 13, 2017, 8:22 p.m. UTC | #4
On Sun, Aug 13, 2017 at 4:19 PM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>
> git send-email --to=... [--cc=...] <patches formatted by git format-patch>

Thanks for the tip. I will give it a try right now using my other email address.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Randy Dunlap Aug. 13, 2017, 9:10 p.m. UTC | #5
On 08/13/2017 01:19 PM, Luc Van Oostenryck wrote:
> On Sun, Aug 13, 2017 at 10:14 PM, Christopher Li <sparse@chrisli.org> wrote:
>>
>> Yes, gmail tend to damage white space. That is why I send
>> attachment before.
> 
> git send-email --to=... [--cc=...] <patches formatted by git format-patch>
> --

or use a different mail program to access gmail (e.g. alpine).
Christopher Li Aug. 13, 2017, 9:25 p.m. UTC | #6
On Sun, Aug 13, 2017 at 4:22 PM, Christopher Li <sparse@chrisli.org> wrote:
>> git send-email --to=... [--cc=...] <patches formatted by git format-patch>
>
> Thanks for the tip. I will give it a try right now using my other email address.

That does not work for me without a fight. Gmail want to use oauth2 etc.
Directly login using smtp will not able to send using just passwords.

I will try my other email account and smtp server. I think as long as
I can make it to the mailing list. Relying from gmail is fine as long
as I don't use the mobile app. The app has problem that always
want to send html mail. Which get rejected by the mailing list.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ramsay Jones Aug. 13, 2017, 9:38 p.m. UTC | #7
On 13/08/17 21:14, Christopher Li wrote:
> On Sun, Aug 13, 2017 at 3:31 PM, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
>> Chris,
>>
>> The patches you're sending are all whitespace damaged.
>> Not only these 4 ones the ones you sent before too.
> 
> Yes, gmail tend to damage white space. That is why I send
> attachment before.

Looking at 'git help format-patch', we find:

...

MUA-SPECIFIC HINTS
       Here are some hints on how to successfully submit patches inline using
       various mailers.

   GMail
       GMail does not have any way to turn off line wrapping in the web
       interface, so it will mangle any emails that you send. You can however
       use "git send-email" and send your patches through the GMail SMTP
       server, or use any IMAP email client to connect to the google IMAP
       server and forward the emails through that.

       For hints on using git send-email to send your patches through the
       GMail SMTP server, see the EXAMPLE section of git-send-email(1).

       For hints on submission using the IMAP interface, see the EXAMPLE
       section of git-imap-send(1).

...

Also, from 'git help send-email':

...

EXAMPLE
   Use gmail as the smtp server
       To use git send-email to send your patches through the GMail SMTP
       server, edit ~/.gitconfig to specify your account settings:

           [sendemail]
                   smtpEncryption = tls
                   smtpServer = smtp.gmail.com
                   smtpUser = yourname@gmail.com
                   smtpServerPort = 587

       If you have multifactor authentication setup on your gmail account, you
       will need to generate an app-specific password for use with git
       send-email. Visit
       https://security.google.com/settings/security/apppasswords to setup an
       app-specific password. Once setup, you can store it with the
       credentials helper:

           $ git credential fill
           protocol=smtp
           host=smtp.gmail.com
           username=youname@gmail.com
           password=app-password

       Once your commits are ready to be sent to the mailing list, run the
       following commands:

           $ git format-patch --cover-letter -M origin/master -o outgoing/
           $ edit outgoing/0000-*
           $ git send-email outgoing/*

       Note: the following perl modules are required Net::SMTP::SSL,
       MIME::Base64 and Authen::SASL

I have to say that I find GMail such a pain that it is not
worth using, but I know that _some_ people have actually
managed to get it to work ... ;-)

[The above documentation is just the start ...]

ATB,
Ramsay Jones

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck Aug. 13, 2017, 9:47 p.m. UTC | #8
On Sun, Aug 13, 2017 at 11:38 PM, Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>
> ...
>
> EXAMPLE
>    Use gmail as the smtp server
>        To use git send-email to send your patches through the GMail SMTP
>        server, edit ~/.gitconfig to specify your account settings:
>
>            [sendemail]
>                    smtpEncryption = tls
>                    smtpServer = smtp.gmail.com
>                    smtpUser = yourname@gmail.com
>                    smtpServerPort = 587
>
>        If you have multifactor authentication setup on your gmail account, you
>        will need to generate an app-specific password for use with git
>        send-email. Visit
>        https://security.google.com/settings/security/apppasswords to setup an
>        app-specific password. Once setup, you can store it with the
>        credentials helper:
>
>            $ git credential fill
>            protocol=smtp
>            host=smtp.gmail.com
>            username=youname@gmail.com
>            password=app-password

It's what I do here.

> I have to say that I find GMail such a pain that it is not
> worth using, but I know that _some_ people have actually
> managed to get it to work ... ;-)

Well, it's just using google SMTP server. The setup is
the same as for any other SMTP server and I like the
app-specific password.

Regards,
-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li Aug. 14, 2017, 12:24 a.m. UTC | #9
On Sun, Aug 13, 2017 at 5:38 PM, Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>
> EXAMPLE
>    Use gmail as the smtp server
>        To use git send-email to send your patches through the GMail SMTP
>        server, edit ~/.gitconfig to specify your account settings:
>
>            [sendemail]
>                    smtpEncryption = tls
>                    smtpServer = smtp.gmail.com
>                    smtpUser = yourname@gmail.com
>                    smtpServerPort = 587
>
>        If you have multifactor authentication setup on your gmail account, you
>        will need to generate an app-specific password for use with git
>        send-email. Visit
>        https://security.google.com/settings/security/apppasswords to setup an
>        app-specific password. Once setup, you can store it with the
>        credentials helper:
>
>            $ git credential fill
>            protocol=smtp
>            host=smtp.gmail.com
>            username=youname@gmail.com
>            password=app-password
>
>        Once your commits are ready to be sent to the mailing list, run the
>        following commands:

Thank you. That is what I just try in the other email. Some how
gmail want to go through some step that I am not comfortable doing.
That is why I wish git send-email has gmail oauth2 support.

I search the internet, some people get it to work using the smtp
server but some did not.

I will find a way to do it.

Thanks again.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 48e1f50..6660220 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@  OS = linux
 CC = gcc
 CFLAGS = -O2 -finline-functions -fno-strict-aliasing -g
 CFLAGS += -Wall -Wwrite-strings
+DBG_CFLAGS = $(ALL_CFLAGS) -DSPARSE_DEBUG
 LDFLAGS += -g
 LD = gcc
 AR = ar
@@ -83,7 +84,9 @@  PROGRAMS += test-inspect
 INST_PROGRAMS += test-inspect
 test-inspect_EXTRA_DEPS := ast-model.o ast-view.o ast-inspect.o
 test-inspect_OBJS := test-inspect.o $(test-inspect_EXTRA_DEPS)
-$(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc): CFLAGS += $(GTK_CFLAGS)
+
+$(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc) \
+$(addprefix debug/, $(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc))
: CFLAGS += $(GTK_CFLAGS)
 test-inspect_EXTRA_OBJS := $(GTK_LIBS)
 else