Skip to content
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

32-bit toolchain warnings #53

Closed
abelbeck opened this issue Mar 25, 2019 · 1 comment
Closed

32-bit toolchain warnings #53

abelbeck opened this issue Mar 25, 2019 · 1 comment

Comments

@abelbeck
Copy link
Contributor

First, Thanks much for ne, a real gem! We are cross-compiling under Buildroot with both 32-bit and 64-bit toolchains.

For the 32-bit toolchain case, I get a handful of warnings because sizeof(char *) and sizeof(int64_t) are different.

As far as I can tell, in this use, these warnings can be safely ignored ... please close this issue if you agree. All occurrences of the warnings are here:

/home/dev/astlinux/trunk/output/host/usr/bin/i586-unknown-linux-gnu-gcc  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -Os  -std=c99 -Wall -Wno-parentheses -D_REGEX_LARGE_OFFSETS -D_GNU_SOURCE -DSTDC_HEADERS -Dinline=__inline__   -O3 -DNDEBUG     -c -o buffer.o buffer.c
buffer.c: In function 'create_mmap_files':
buffer.c:1197:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     ld_buffer_syn[ld_count].line = (char *)start_of_line;
                                    ^
buffer.c:1201:39: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     ld_buffer_no_syn[ld_count].line = (char *)start_of_line;
                                       ^
buffer.c:1231:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   ld_buffer_syn[ld_count].line = (char *)start_of_line;
                                  ^
buffer.c:1235:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   ld_buffer_no_syn[ld_count].line = (char *)start_of_line;
                                     ^
buffer.c: In function 'load_fd_mmap':
buffer.c:1275:41: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      ld->line = ld->line_len ? char_p + (int64_t)ld->line : NULL;
                                         ^
buffer.c:1281:41: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      ld->line = ld->line_len ? char_p + (int64_t)ld->line : NULL;
                                         ^
@vigna
Copy link
Owner

vigna commented Mar 25, 2019

You're right. Those line of code temporarily store the pointers in line descriptors as integer offsets. Initially the pointers are syntactically too small (32 bit), but the offsets are in a memory-mapped file, so semantically they are 32-bit, too. The last two warnings are actually widening conversions, so there's no problem there.

The real issue is that it doesn't make any sense to have a 32-bit editor with 64-bit line lengths, line numbers and so on, but making this configurable would be a lot of work.

@vigna vigna closed this as completed Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants