From: Juan Perez-Sanchez <lithoxs@gmail.com>
To: linux-8086 <linux-8086@vger.kernel.org>
Subject: [PATCH 4/5] Removal of ia16-unknown-elks-gcc warnings
Date: Thu, 21 May 2015 09:25:35 -0500 [thread overview]
Message-ID: <CAD6VGuaDHj74QqzCfetQcRz7DcV6hf6-hz3cwatVBFijsMxvFA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 172 bytes --]
Mostly warnings removed by fixing prototypes.
Fix an error in fs/exec.c uncovered by the compiler.
Code size was reduced by 32 bytes and data size reduced 4 bytes.
Juan
[-- Attachment #2: elks-3w.patch --]
[-- Type: text/x-patch, Size: 12634 bytes --]
diff -Nur elks.orig/arch/i86/drivers/block/genhd.c elks/arch/i86/drivers/block/genhd.c
--- elks.orig/arch/i86/drivers/block/genhd.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/arch/i86/drivers/block/genhd.c 2015-05-06 17:26:28.000000000 -0500
@@ -28,7 +28,6 @@
#define NR_SECTS(p) p->nr_sects
#define START_SECT(p) p->start_sect
-extern int chr_dev_init();
extern int blk_dev_init();
struct gendisk *gendisk_head = NULL;
diff -Nur elks.orig/arch/i86/drivers/block/init.c elks/arch/i86/drivers/block/init.c
--- elks.orig/arch/i86/drivers/block/init.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/arch/i86/drivers/block/init.c 2015-05-06 17:26:28.000000000 -0500
@@ -27,7 +27,7 @@
#include <arch/system.h>
extern void rd_load();
-extern int chr_dev_init();
+extern void chr_dev_init();
extern int blk_dev_init();
void device_setup(void)
diff -Nur elks.orig/arch/i86/drivers/char/init.c elks/arch/i86/drivers/char/init.c
--- elks.orig/arch/i86/drivers/char/init.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/arch/i86/drivers/char/init.c 2015-05-06 17:26:28.000000000 -0500
@@ -2,7 +2,7 @@
#include <linuxmt/types.h>
#include <linuxmt/init.h>
-int chr_dev_init(void)
+void chr_dev_init(void)
{
#ifdef CONFIG_CHAR_DEV_RS
rs_init();
diff -Nur elks.orig/arch/i86/drivers/char/pty.c elks/arch/i86/drivers/char/pty.c
--- elks.orig/arch/i86/drivers/char/pty.c 2015-05-06 17:01:42.000000000 -0500
+++ elks/arch/i86/drivers/char/pty.c 2015-05-06 17:26:28.000000000 -0500
@@ -103,12 +103,13 @@
l = (file->f_flags & O_NONBLOCK) ? 0 : 1;
pi = 0;
while (((int)pi) < len) {
- if(chq_getch(&tty->outq, &ch, l) == -1)
+ if(chq_getch(&tty->outq, &ch, l) == -1) {
if (l) {
debug("failed: INTR\n");
return -EINTR;
} else
break;
+ }
debug2(" rc[%u,%u]", (int)pi, len);
put_user_char(ch, (void *)(data++));
++pi;
@@ -133,12 +134,13 @@
pi = 0;
while (((int)pi) < len) {
ch = get_user_char((void *)(data++));
- if (chq_addch(&tty->inq, ch, l) == -1)
+ if (chq_addch(&tty->inq, ch, l) == -1) {
if (l) {
debug("failed: INTR\n");
return -EINTR;
} else
break;
+ }
pi++;
debug(" wc");
}
diff -Nur elks.orig/arch/i86/drivers/char/sibo_key.c elks/arch/i86/drivers/char/sibo_key.c
--- elks.orig/arch/i86/drivers/char/sibo_key.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/arch/i86/drivers/char/sibo_key.c 2015-05-06 17:26:28.000000000 -0500
@@ -1,7 +1,5 @@
#include <linuxmt/sched.h>
#include <linuxmt/types.h>
-#include <arch/io.h>
-#include <arch/keyboard.h>
#include <linuxmt/errno.h>
#include <linuxmt/fs.h>
#include <linuxmt/fcntl.h>
@@ -9,6 +7,9 @@
#include <linuxmt/chqueue.h>
#include <linuxmt/ntty.h>
+#include <arch/io.h>
+#include <arch/keyboard.h>
+
#ifdef CONFIG_SIBO_CONSOLE_DIRECT
extern struct tty ttys[];
@@ -22,7 +23,7 @@
#define MENU 0x1000
#define PSION 0x8000
-#define ANYSHIFT LSHIFT|RSHIFT
+#define ANYSHIFT (LSHIFT|RSHIFT)
void AddQueue(unsigned char Key);
@@ -46,11 +47,8 @@
void keyboard_irq(int irq, struct pt_regs *regs, void *data)
{
- int modifiers;
- int key;
-
- modifiers = psiongetchar();
- key = (modifiers & 0x00FF);
+ int modifiers = psiongetchar();
+ int key = (modifiers & 0x00FF);
/* no key pressed */
if (key == 0) {
diff -Nur elks.orig/arch/i86/drivers/char/xt_key.c elks/arch/i86/drivers/char/xt_key.c
--- elks.orig/arch/i86/drivers/char/xt_key.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/arch/i86/drivers/char/xt_key.c 2015-05-06 17:26:28.000000000 -0500
@@ -114,14 +114,9 @@
* There needs to be many buffers if we implement virtual consoles...... *
*************************************************************************/
-int KeyboardInit(void)
-{
- /* Do nothing */ ;
-}
-
void xtk_init(void)
{
- KeyboardInit();
+ /* Do nothing */;
}
/*
diff -Nur elks.orig/arch/i86/kernel/signal.c elks/arch/i86/kernel/signal.c
--- elks.orig/arch/i86/kernel/signal.c 2015-05-06 17:01:25.000000000 -0500
+++ elks/arch/i86/kernel/signal.c 2015-05-06 17:26:28.000000000 -0500
@@ -25,7 +25,7 @@
unsigned signr;
while ((currentp->signal &= ((1L << NSIG) - 1))) {
- signr = find_first_non_zero_bit(¤tp->signal, NSIG);
+ signr = find_first_non_zero_bit((void *)(¤tp->signal), NSIG);
clear_bit(signr, ¤tp->signal);
debug2("Process %d has signal %d.\n", currentp->pid, signr);
diff -Nur elks.orig/fs/exec.c elks/fs/exec.c
--- elks.orig/fs/exec.c 2015-05-06 17:01:32.000000000 -0500
+++ elks/fs/exec.c 2015-05-06 17:26:28.000000000 -0500
@@ -86,18 +86,18 @@
*/
if((retval = open_filp(O_RDONLY, inode, &filp)))
goto error_exec2;
- retval = -ENOEXEC;
- if(!(filp->f_op) || !(filp->f_op->read))
- goto error_exec3;
-
- debug1("EXEC: Inode dev = 0x%x opened OK.\n", inode->i_dev);
-
/*
* Read the header.
*/
tregs = ¤t->t_regs;
ds = tregs->ds;
+ retval = -ENOEXEC;
+ if(!(filp->f_op) || !(filp->f_op->read))
+ goto error_exec3;
+
+ debug1("EXEC: Inode dev = 0x%x opened OK.\n", inode->i_dev);
+
/*
* can I trust the following fields?
*/
@@ -220,14 +220,14 @@
/*
* Wipe the BSS.
*/
- fmemset((__u16) mh.dseg + stack_top, dseg, 0, (__u16) mh.bseg);
+ fmemset((char *)((seg_t)mh.dseg + stack_top), dseg, 0, (__u16) mh.bseg);
/*
* Copy the stack
*/
ptr = (stack_top)
? (char *) (stack_top - slen)
- : (char *) (len - slen);
+ : (char *) ((size_t)len - slen);
fmemcpy(dseg, (__u16) ptr, current->mm.dseg, (__u16) sptr, (__u16) slen);
/* argv and envp are two NULL-terminated arrays of pointers, located
diff -Nur elks.orig/fs/minix/bitmap.c elks/fs/minix/bitmap.c
--- elks.orig/fs/minix/bitmap.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/fs/minix/bitmap.c 2015-05-06 17:26:28.000000000 -0500
@@ -116,7 +116,7 @@
for (i = 0; i < 8; i++)
if ((bh = sb->u.minix_sb.s_zmap[i]) != NULL) {
map_buffer(bh);
- j = (block_t) find_first_zero_bit(bh->b_data, 8192);
+ j = (block_t) find_first_zero_bit((void *)(bh->b_data), 8192);
if (j < 8192)
break;
unmap_buffer(bh);
@@ -128,7 +128,7 @@
unmap_buffer(bh);
goto repeat;
}
- if (j == (block_t) find_first_zero_bit(bh->b_data, 8192))
+ if (j == (block_t) find_first_zero_bit((void *)(bh->b_data), 8192))
panic("still zero bit!%d\n", j);
unmap_buffer(bh);
mark_buffer_dirty(bh, 1);
@@ -211,7 +211,7 @@
for (i = 0; i < 8; i++)
if ((bh = inode->i_sb->u.minix_sb.s_imap[i]) != NULL) {
map_buffer(bh);
- j = (block_t) find_first_zero_bit(bh->b_data, 8192);
+ j = (block_t) find_first_zero_bit((void *)(bh->b_data), 8192);
if (j < 8192)
break;
unmap_buffer(bh);
diff -Nur elks.orig/fs/minix/truncate.c elks/fs/minix/truncate.c
--- elks.orig/fs/minix/truncate.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/fs/minix/truncate.c 2015-05-06 17:26:28.000000000 -0500
@@ -119,7 +119,7 @@
for (i = 0; i < 512; i++)
if (*(ind++))
break;
- if (i >= 512)
+ if (i >= 512) {
if (ind_bh->b_count != 1)
retry = 1;
else {
@@ -127,6 +127,7 @@
*p = 0;
minix_free_block(inode->i_sb, tmp);
}
+ }
unmap_brelse(ind_bh);
return retry;
}
@@ -166,7 +167,7 @@
for (i = 0; i < 512; i++)
if (*(dind++))
break;
- if (i >= 512)
+ if (i >= 512) {
if (dind_bh->b_count != 1)
retry = 1;
else {
@@ -175,6 +176,7 @@
inode->i_dirt = 1;
minix_free_block(inode->i_sb, tmp);
}
+ }
unmap_brelse(dind_bh);
return retry;
}
diff -Nur elks.orig/fs/romfs/inode.c elks/fs/romfs/inode.c
--- elks.orig/fs/romfs/inode.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/fs/romfs/inode.c 2015-05-06 17:26:28.000000000 -0500
@@ -319,7 +319,7 @@
offset = filp->f_pos;
if (!offset) {
offset = (loff_t) (i->i_ino & ROMFH_MASK);
- if (romfs_copyfrom(i, &ri, offset, (size_t) ROMFH_SIZE) <= 0)
+ if (romfs_copyfrom(i, (char *)(&ri), offset, (size_t) ROMFH_SIZE) <= 0)
return stored;
offset = (loff_t) ntohl(ri.spec) & ROMFH_MASK;
}
@@ -334,7 +334,7 @@
filp->f_pos = offset;
/* Fetch inode info */
- if (romfs_copyfrom(i, &ri, offset, (size_t) ROMFH_SIZE) <= 0)
+ if (romfs_copyfrom(i, (char *)(&ri), offset, (size_t) ROMFH_SIZE) <= 0)
return stored;
j = romfs_strnlen(i, offset + ROMFH_SIZE, (size_t) sizeof(fsname) - 1);
@@ -375,7 +375,7 @@
offset = ((loff_t) dir->i_ino) & ROMFH_MASK;
- if (romfs_copyfrom(dir, &ri, offset, (size_t) ROMFH_SIZE) <= 0) {
+ if (romfs_copyfrom(dir, (char *)(&ri), offset, (size_t) ROMFH_SIZE) <= 0) {
res = -ENOENT;
goto out;
}
@@ -385,7 +385,7 @@
for (;;) {
if (!offset || offset >= maxoff
- || romfs_copyfrom(dir, &ri, offset, (size_t) ROMFH_SIZE) <= 0) {
+ || romfs_copyfrom(dir, (char *)(&ri), offset, (size_t) ROMFH_SIZE) <= 0) {
res = -ENOENT;
goto out;
}
@@ -614,7 +614,7 @@
/* Loop for finding the real hard link */
for (;;) {
- if (romfs_copyfrom(i, &ri, (loff_t) ino, (size_t) ROMFH_SIZE) <= 0) {
+ if (romfs_copyfrom(i, (char *)(&ri), (loff_t) ino, (size_t) ROMFH_SIZE) <= 0) {
printk("romfs: read error for inode 0x%x%x\n",
(int) (ino >> 16), (int) ino);
return;
diff -Nur elks.orig/include/arch/irq.h elks/include/arch/irq.h
--- elks.orig/include/arch/irq.h 2015-05-06 17:01:25.000000000 -0500
+++ elks/include/arch/irq.h 2015-05-06 17:26:28.000000000 -0500
@@ -57,6 +57,11 @@
#define set_irq() asm("sti")
#endif
+#ifdef __ia16__
+#define clr_irq() asm("cli")
+#define set_irq() asm("sti")
+#endif
+
#ifdef __WATCOMC__
#define clr_irq() _asm {cli}
#define set_irq() _asm {sti}
diff -Nur elks.orig/include/linuxmt/kdev_t.h elks/include/linuxmt/kdev_t.h
--- elks.orig/include/linuxmt/kdev_t.h 2015-04-26 11:39:15.000000000 -0500
+++ elks/include/linuxmt/kdev_t.h 2015-05-06 17:26:28.000000000 -0500
@@ -20,6 +20,10 @@
#define INCLUDE_OK
#endif
+#ifdef __ia16__
+#define INCLUDE_OK
+#endif
+
#ifdef S_SPLINT_S
#define INCLUDE_OK
#endif
diff -Nur elks.orig/include/linuxmt/ntty.h elks/include/linuxmt/ntty.h
--- elks.orig/include/linuxmt/ntty.h 2015-05-06 17:01:42.000000000 -0500
+++ elks/include/linuxmt/ntty.h 2015-05-06 17:26:28.000000000 -0500
@@ -8,9 +8,22 @@
#define INQ_SIZE 512
#define OUTQ_SIZE 64
+/*
+ * Note: don't mess with NR_PTYS until you understand the tty minor
+ * number allocation game...
+ * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
+ * hardcoded at present.)
+ */
+
+#define NR_PTYS 4
+
/* This value is a bit of a problem because ntty.c hard-codes some
* array indices that go up as high as 8 + NR_PTYS (below). */
+#ifdef CONFIG_PSEUDO_TTY
+#define NUM_TTYS 6/*8+NR_PTYS*/ /* FIXME: For the time being, will leave as before */
+#else
#define NUM_TTYS 6
+#endif
#define DCGET_GRAPH (('D'<<8)+0x01)
#define DCREL_GRAPH (('D'<<8)+0x02)
@@ -26,15 +39,6 @@
#include <arch/system.h>
-/*
- * Note: don't mess with NR_PTYS until you understand the tty minor
- * number allocation game...
- * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
- * hardcoded at present.)
- */
-
-#define NR_PTYS 4
-
/* Most likely, not all of these will get used */
struct tty_ops {
diff -Nur elks.orig/init/main.c elks/init/main.c
--- elks.orig/init/main.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/init/main.c 2015-05-06 17:26:28.000000000 -0500
@@ -83,7 +83,7 @@
* \argc
*/
-/*@unused@*/ static char envp[] = "\0\0";
+/*static char envp[] = "\0\0";*/
static void init_task()
{
diff -Nur elks.orig/kernel/fork.c elks/kernel/fork.c
--- elks.orig/kernel/fork.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/kernel/fork.c 2015-05-06 17:26:28.000000000 -0500
@@ -82,7 +82,7 @@
} else {
t->mm.dseg = mm_dup(currentp->mm.dseg);
- if (t->mm.dseg == NULL) {
+ if (t->mm.dseg == 0) {
mm_free(currentp->mm.cseg);
t->state = TASK_UNUSED;
task_slots_unused++;
diff -Nur elks.orig/kernel/printk.c elks/kernel/printk.c
--- elks.orig/kernel/printk.c 2015-04-26 11:39:15.000000000 -0500
+++ elks/kernel/printk.c 2015-05-06 17:26:28.000000000 -0500
@@ -146,7 +146,7 @@
if(*(fmt-2) == 'l')
v = va_arg(p, unsigned long);
else
- v = (long)(va_arg(p, short));
+ v = (long)(va_arg(p, int));
goto NUMOUT;
case 'o':
tmp -= 2;
@@ -160,7 +160,7 @@
if(*(fmt-2) == 'l')
v = va_arg(p, unsigned long);
else
- v = (unsigned long)(va_arg(p, unsigned short));
+ v = (unsigned long)(va_arg(p, unsigned int));
NUMOUT:
numout(v, width, tmp, (c == 'd'), (c == 'X'), zero);
break;
reply other threads:[~2015-05-21 14:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAD6VGuaDHj74QqzCfetQcRz7DcV6hf6-hz3cwatVBFijsMxvFA@mail.gmail.com \
--to=lithoxs@gmail.com \
--cc=linux-8086@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).