Skip to content

Correct fscanf formatting string for I64u values #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2015

Conversation

weakcamel
Copy link

Signed-off-by: Waldek Maleska w.maleska@gmail.com

Signed-off-by: Waldek Maleska <w.maleska@gmail.com>
@weakcamel
Copy link
Author

As discussed at #52 (comment)

@dscho
Copy link
Member

dscho commented Apr 8, 2015

@weakcamel are you still interested in this issue? If so, I would be very interested in your opinion about my suggestion.

@weakcamel
Copy link
Author

I am and yes, I like the idea.
At first I wondered if defining those constants wouldn't interfere with including inttypes.h after someone includes the git-compat-utils.h or mingw.h
The former already requires the standard header - so no problem there.
The latter being mingw/windows specific, I can't imagine someone to include it otherwise.

I'll go ahead and prepare a patch.

@dscho
Copy link
Member

dscho commented Apr 10, 2015

To be sure, I did not suggest including any header there, just introducing a block

#ifndef SCNuMAX
#define SCNuMAX PRIuMAX
#endif`

not anything more...

Assisted-By: Johannes Schindelin <johannes.schindelin@gmx.de>
@weakcamel
Copy link
Author

Done (finally!). Thank you for you patience.
Let me know if I should squash it or of course if you see ny problems.

@dscho
Copy link
Member

dscho commented Apr 12, 2015

Thanks! I added a comment with a question and would like to request a squash and rebase followed by a force-push to finalize this Pull Request.

@dscho
Copy link
Member

dscho commented Apr 15, 2015

Checked and it's not enough - the warnings are back - SCNuMAX is back at "llu". Can't yet tell where it comes from, I just had a moment to look into it

You can check by inserting #define SCNuMAX PRIuMAX right before weakcamel@4b096a0#diff-29b0a2def034550470a8eb7e8b673403L225 and compiling (gcc will complain that the constant has been redefined and tell you where the original definition came from).

@weakcamel
Copy link
Author

Thank you!

Well, the definition comes from .. git-compat-utils.h
So either we should include mingw.h before the, or repeat the OS-specific magic in it.
What do you think?

@dscho
Copy link
Member

dscho commented Apr 16, 2015

Hmm. I wonder why it works for PRIuMAX, but not SCNuMAX: after all, we #define PRIuMAX in compat/mingw.h and git-compat-util.h sees that and does not redefine it. In my mind, at that stage, SCNuMAX should not yet be #defined, but PRIuMAX should be, correctly, so it should work. I guess I'll need to dig into this myself...

@weakcamel
Copy link
Author

They're both at 'llu'. I've added #pragma message in git-compat-utils.h and in general, without loading definitions from <inttypes.h> they're wrong on 32-bits.

$ rm builtin/gc.o && make builtin/gc.o
    CC builtin/gc.o
In file included from ./builtin.h:4:0,
                 from builtin/gc.c:13:
./git-compat-util.h:263:9: note: #pragma message: llullu
 #pragma message PRIuMAX SCNuMAX
         ^
...

@dscho dscho merged commit 38e0eea into git-for-windows:master Apr 22, 2015
dscho added a commit that referenced this pull request Apr 22, 2015
Correct fscanf formatting string for I64u values

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
Copy link
Member

dscho commented Apr 22, 2015

In my tests, the SCNuMAX constant was actually defined correctly if I skipped the change to compat/mingw.h, so I mangled your patch. Hopefully you do not mind!

@weakcamel
Copy link
Author

I do not mind and all. I'm glad you did. Thank you!

@weakcamel weakcamel deleted the fscanf-64bit-constants branch April 22, 2015 19:13
dscho added a commit that referenced this pull request Apr 23, 2015
Correct fscanf formatting string for I64u values

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho added a commit that referenced this pull request Apr 30, 2015
Correct fscanf formatting string for I64u values

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho added a commit that referenced this pull request May 1, 2015
Correct fscanf formatting string for I64u values

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants