]> git.alsa-project.org Git - alsa-tools.git/commitdiff
as10k1: fix gcc warnings
authorJaroslav Kysela <perex@perex.cz>
Sun, 26 Jan 2025 12:05:40 +0000 (13:05 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 27 Jan 2025 09:44:14 +0000 (10:44 +0100)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
as10k1/as10k1.c
as10k1/assemble.c
as10k1/macro.c
as10k1/parse.c
as10k1/parse.h

index e226051edd39192d84401074d77d12c2bcd8da91..079f1c26f9e3d8c1f46e7530b5c7d9ba597d77eb 100644 (file)
@@ -244,6 +244,7 @@ void asm_open(char *name)
         struct stat st;
         char *next;
         int backup_line_num,backup_file_num;
+        size_t rsize;
 
     
                 
@@ -284,8 +285,10 @@ void asm_open(char *name)
         
         buff[i].mem_end = buff[i].mem_start+st.st_size;
         
-        read(fd, buff[i].mem_start, st.st_size);
+        rsize = read(fd, buff[i].mem_start, st.st_size);
         close(fd);
+        if (rsize != st.st_size)
+                as_exit("short read from input file\n");
          
 #ifdef DEBUG        
        printf("File %s opened:\n",name);
@@ -383,13 +386,14 @@ void output_tram_line(struct list_head *line_head, int type)
                         val = __cpu_to_le32(tram_sym->data.value);
                         fwrite(&val,sizeof(u32),1,fp);
                        if(listing){
-                               if(type==TYPE_TRAM_ADDR_READ)
+                               if(type==TYPE_TRAM_ADDR_READ) {
                                        fprintf(listfile,"\tRead");
-                               else
+                               } else {
                                        fprintf(listfile,"\tWrite");
+                               }
                        
-                                       fprintf(listfile,": 0x3%02x/0x2%02x (%s), offset 0x%07x\n",tram_sym->data.address,tram_sym->data.address,
-                                               (prev_sym((&tram_sym->list)))->data.name,tram_sym->data.value);
+                               fprintf(listfile,": 0x3%02x/0x2%02x (%s), offset 0x%07x\n",tram_sym->data.address,tram_sym->data.address,
+                                       (prev_sym((&tram_sym->list)))->data.name,tram_sym->data.value);
                        }
                        
                 }
index 45089737737822eb19f0cf4538fed3adaf6e5929..ced57c70e495123e51f56e2f27185f9f38d2aa53 100644 (file)
@@ -22,6 +22,7 @@
 
 #include"types.h"
 #include"proto.h"
+#include"parse.h"
 
 extern int dbg_opt;
 extern FILE *listfile;
@@ -45,7 +46,6 @@ void op(int op, int z,int  w,int  x,int  y)
        int  w0, w1;
         extern int dsp_code[DSP_CODE_SIZE];
         extern int ip;
-        extern char op_codes[35][9];
        extern char listtemp[60];
        if (ip >= 0x200)
                as_exit("to many instructions");
@@ -306,7 +306,6 @@ void add_symbol(char *name, u16 type, u16 address, u32 value)
        
         extern int gpr_input_count,gpr_output_count,gpr_static_count,gpr_dynamic_count,gpr_control_count,gpr_constant_count;
         struct sym *sym;
-        struct tram *tmp_ptr;
         extern struct list_head sym_head;
         extern struct delay tram_delay[MAX_TANK_ADDR];
         extern struct lookup tram_lookup[MAX_TANK_ADDR];
@@ -356,10 +355,8 @@ void add_symbol(char *name, u16 type, u16 address, u32 value)
                         else
                                 tram_delay[tmp].write++;
                 }else{
-                        tmp_ptr=(struct tram *)sym;
                         list_add_tail(&(((struct tram *)sym)->tram) , &(tram_lookup[tmp].tram) );
-                       tmp_ptr=(struct tram *)sym;
-                                if(type== TYPE_TRAM_ADDR_READ)
+                        if(type== TYPE_TRAM_ADDR_READ)
                                 tram_lookup[tmp].read++;   
                         else
                                 tram_lookup[tmp].write++;
index a01ad6fe9db907c6e6299f87688e079466b0c040..70e4ef9347439f0967b7450c0029213934400fc5 100644 (file)
@@ -72,14 +72,11 @@ void new_macro(char *symbol, char *line, char *operand)
 void macro_expand(int macnum,char *operand )
 {
         char *line,*next;
-        int done=0,i,old;
+        int done=0,old;
         extern unsigned int macro_depth;
         extern int macro_line_num;
         char string[MAX_LINE_LENGTH];
        
-        //initialize macro use:
-        i=0;
-       
         if(macro_depth+1> MAX_MAC_DEPTH)
                 as_exit("Error exceeded maximum number of recursive macro calls");
 
index 8523717904187a0f5d1f121c058a0c720bb74a53..02d4f5e32747160ca1f6d848fce00ef2eeb82800 100644 (file)
@@ -18,6 +18,7 @@
 #include<string.h>
 #include<stdio.h>
 #include"types.h"
+#define DECLARE_OP_CODES
 #include"parse.h"
 #include"proto.h" 
 
@@ -87,7 +88,7 @@ int parse( char line_string[MAX_LINE_LENGTH], char *line)
         if((tmp=ismacro(op_name_ptr)) != -1 ){
                 if(defmacro==0)
                         macro_expand(tmp,strtok(NULL,""));
-                       return(0);
+               return(0);
         }
        
         if( (op_num=op_decode(op_name_ptr))==-1) {
index be71daaa2c15c0feaf611c7cc2a4aa3d3e333ea5..b79ed8b7ebd4446c3fd8376e9fed728db9f472b4 100644 (file)
@@ -63,7 +63,9 @@ enum foo {
         
 };
 
-
+#ifndef DECLARE_OP_CODES
+extern char op_codes[NUM_OPS+1][9];
+#else
 char op_codes[NUM_OPS+1][9]=
   {
     "MACS",
@@ -110,6 +112,7 @@ char op_codes[NUM_OPS+1][9]=
     "con",
     "NotAnOp"
   };
+#endif
 
 //extern int file_num,source_line_num