warning:deprecated conversion from string constant to 'char *'解决方案

本文详细解析了在使用较新版本的GCC编译器时,因char指针不当使用而导致的编译警告问题。介绍了如何正确地声明和使用指向字符串的指针,包括使用const修饰符来避免对字符串常量的非法修改。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址:http://blog.youkuaiyun.com/xyy410874116/article/details/6397549

Linux 环境下当GCC版本比较高时,编译代码可能出现的问题

问题是这样产生的,先看这个函数原型:

void someFunc(char *someStr);

再看这个函数调用:

someFunc("I'm a string!");

把这两个东西组合起来,用最新的g++编译一下就会得到标题中的警告。

为什么呢?原来char *背后的含义是:给我个字符串,我要修改它。

而理论上,我们传给函数的字面常量是没法被修改的

所以说,比较和理的办法是把参数类型修改为const char *

这个类型说背后的含义是:给我个字符串,我只要读取它。

很自然的延伸一下。

如果我既要传字面常量又要传字符串变量怎么办呢?......重载

实验:

对deprecated conversion from string constant to 'char *'此类警告的详细解释

假定你想使用一个char*类型的变量,有时指向一个字符串,有时指向另外一个字符串。开始的代码就像这样:
char *msg;
msg = "hello";
msg = "good-bye";

编译器会对这段代码给出两段警示,说”deprecated conversion from string constant to 'char *'",意思就是说你没有能力修改字符串的内容。如果将代码写成这样,如:
char *msg = "hello";
*msg = 'j';
printf( "%s/n", "hello" );

编译器会通过编译,实际上会将msg指向的内容从"hello"转变为"jello", 正确的解决方法是将msg声明为一个指向不变字符串的指针
const char  *msg;
msg = "hello";
msg = "good-bye";

这段代码可以成功编译,并且将msg指向的值如愿改变,但如果你将指针指向的指进行赋值
*msg = 'j';
将会产生一个错误,不能修改一个字符串常量

注意如下的代码,此代码编译时不会出现警告也不会出现任何错误:
const char  *msg;
char   buf[ 10 ];   //注意不能使用char *buf;
sprintf( buf, "%03d/n", 7 );
msg = buf;

改变buf的内容是可以的,因为它并没有被声明为常量。在这种情况下,msg将指向一个字符串,"007/n". 像这种语句
*buf = 'x';
将会正确编译执行,但像
*msg = 'x';
将会产生一个警告,因为msg指向的内容不允许改变


还有一种方法是使用强制转换,使用强制转换意味着你清楚会出现什么情况,不需要编译器为你做出判断,例如下面的代码将不会产生警告:
char  *msg;
msg = (char *) "hello";


但一旦你使用强制转换,编译器对如下语句进行编译时,也不会出现错误或警告
*msg = 'j';

这个错误将一直存在,但并不会被发现,直到运行时。那时再找出错点就相当麻烦了,比编译器提醒你,麻烦多了。所以,最好不要对字符串使用强制转换。

Constant 指针

根据constant的位置不同,可以有以下四种情况:
const char* const msg_0;
const char       *msg_1;
char* const msg_2;
char       *msg_3;


其中,msg_0是一个constant指针指向一个const字符串。这个声明编译器会给出一个警告,因为msg_0的指向没有被初始化,而且之后的语句也无法对mg_0进行赋值,如
const char const *msg_0 = "hello";
会编译成功,但
*msg_0 = 'j';或者
msg_0 = "good-bye"; 将会产生错误

msg_1既可以指向一个const字符串,也可以指向一个可变的字符串,但是不能修改它所指向的字符串的内容。

编译msg_2这条语句,会出现和编译msg_0一样的错误。因为指针是一个常量,所以它应该首先被赋值如果刚开始已经赋值,那么它可以对指向的字符串内容进行修改,如:
char        buf[ 10 ];
char * const msg_2 = buf;
这段代码里,msg_2指向buf[0],并且永远指向这个地址,不会改变;

对于msg_3,就没太多可以说的。你可以改变指针,也可以改变指针指向的内容

tianhangsong@ubuntu:~/NachOS-4.1/code/build.linux$ make depend g++ -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -M ../lib/bitmap.cc ../lib/debug.cc ../lib/hash.cc ../lib/libtest.cc ../lib/list.cc ../lib/sysdep.cc ../machine/interrupt.cc ../machine/stats.cc ../machine/timer.cc ../machine/console.cc ../machine/machine.cc ../machine/mipssim.cc ../machine/translate.cc ../machine/network.cc ../machine/disk.cc ../threads/alarm.cc ../threads/kernel.cc ../threads/main.cc ../threads/scheduler.cc ../threads/synch.cc ../threads/synchlist.cc ../threads/thread.cc ../userprog/addrspace.cc ../userprog/exception.cc ../userprog/synchconsole.cc ../filesys/directory.cc ../filesys/filehdr.cc ../filesys/filesys.cc ../filesys/pbitmap.cc ../filesys/openfile.cc ../filesys/synchdisk.cc ../network/post.cc > makedep ed - Makefile.dep < eddep rm eddep makedep tianhangsong@ubuntu:~/NachOS-4.1/code/build.linux$ make g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../lib/bitmap.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../lib/debug.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../lib/libtest.cc ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] "7", "8", "9", "10", "11", "12", "13", "14"}; ^ ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../lib/libtest.cc:59:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../lib/sysdep.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../machine/interrupt.cc ../machine/interrupt.cc:29:45: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] static char *intLevelNames[] = { "off", "on"}; ^ ../machine/interrupt.cc:29:45: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/interrupt.cc:32:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] "network recv"}; ^ ../machine/interrupt.cc:32:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/interrupt.cc:32:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/interrupt.cc:32:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/interrupt.cc:32:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/interrupt.cc:32:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../machine/stats.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../machine/timer.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../machine/console.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../machine/machine.cc ../machine/machine.cc:19:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] "illegal instruction" }; ^ ../machine/machine.cc:19:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/machine.cc:19:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/machine.cc:19:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/machine.cc:19:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/machine.cc:19:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/machine.cc:19:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/machine.cc:19:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../machine/mipssim.cc In file included from ../machine/mipssim.cc:22:0: ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] }; ^ ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.h:227:7: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ../machine/mipssim.cc: In member function ‘void Machine::OneInstruction(Instruction*)’: ../machine/mipssim.cc:139:56: warning: array subscript has type ‘char’ [-Wchar-subscripts] struct OpString *str = &opStrings[instr->opCode]; ^ ../machine/mipssim.cc:158:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] sum = registers[instr->rs] + registers[instr->rt]; ^ ../machine/mipssim.cc:158:50: warning: array subscript has type ‘char’ [-Wchar-subscripts] sum = registers[instr->rs] + registers[instr->rt]; ^ ../machine/mipssim.cc:159:28: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (!((registers[instr->rs] ^ registers[instr->rt]) & SIGN_BIT) && ^ ../machine/mipssim.cc:159:51: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (!((registers[instr->rs] ^ registers[instr->rt]) & SIGN_BIT) && ^ ../machine/mipssim.cc:160:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] ((registers[instr->rs] ^ sum) & SIGN_BIT)) { ^ ../machine/mipssim.cc:164:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = sum; ^ ../machine/mipssim.cc:168:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] sum = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:169:28: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (!((registers[instr->rs] ^ instr->extra) & SIGN_BIT) && ^ ../machine/mipssim.cc:174:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = sum; ^ ../machine/mipssim.cc:178:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:178:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:182:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] + registers[instr->rt]; ^ ../machine/mipssim.cc:182:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] + registers[instr->rt]; ^ ../machine/mipssim.cc:182:67: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] + registers[instr->rt]; ^ ../machine/mipssim.cc:186:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] & registers[instr->rt]; ^ ../machine/mipssim.cc:186:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] & registers[instr->rt]; ^ ../machine/mipssim.cc:186:67: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] & registers[instr->rt]; ^ ../machine/mipssim.cc:190:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = registers[instr->rs] & (instr->extra & 0xffff); ^ ../machine/mipssim.cc:190:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = registers[instr->rs] & (instr->extra & 0xffff); ^ ../machine/mipssim.cc:194:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] == registers[instr->rt]) ^ ../machine/mipssim.cc:194:49: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] == registers[instr->rt]) ^ ../machine/mipssim.cc:201:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (!(registers[instr->rs] & SIGN_BIT)) ^ ../machine/mipssim.cc:206:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] > 0) ^ ../machine/mipssim.cc:211:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] <= 0) ^ ../machine/mipssim.cc:218:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] & SIGN_BIT) ^ ../machine/mipssim.cc:223:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] != registers[instr->rt]) ^ ../machine/mipssim.cc:223:49: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] != registers[instr->rt]) ^ ../machine/mipssim.cc:228:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rt] == 0) { ^ ../machine/mipssim.cc:232:45: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[LoReg] = registers[instr->rs] / registers[instr->rt]; ^ ../machine/mipssim.cc:232:68: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[LoReg] = registers[instr->rs] / registers[instr->rt]; ^ ../machine/mipssim.cc:233:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[HiReg] = registers[instr->rs] % registers[instr->rt]; ^ ../machine/mipssim.cc:233:67: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[HiReg] = registers[instr->rs] % registers[instr->rt]; ^ ../machine/mipssim.cc:238:43: warning: array subscript has type ‘char’ [-Wchar-subscripts] rs = (unsigned int) registers[instr->rs]; ^ ../machine/mipssim.cc:239:43: warning: array subscript has type ‘char’ [-Wchar-subscripts] rt = (unsigned int) registers[instr->rt]; ^ ../machine/mipssim.cc:258:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[NextPCReg] + 4; ^ ../machine/mipssim.cc:260:31: warning: array subscript has type ‘char’ [-Wchar-subscripts] pcAfter = registers[instr->rs]; ^ ../machine/mipssim.cc:265:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:279:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:297:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = instr->extra << 16; ^ ../machine/mipssim.cc:301:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:313:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:341:41: warning: array subscript has type ‘char’ [-Wchar-subscripts] nextLoadValue = registers[instr->rt]; ^ ../machine/mipssim.cc:365:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:393:41: warning: array subscript has type ‘char’ [-Wchar-subscripts] nextLoadValue = registers[instr->rt]; ^ ../machine/mipssim.cc:421:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[HiReg]; ^ ../machine/mipssim.cc:425:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[LoReg]; ^ ../machine/mipssim.cc:429:40: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[HiReg] = registers[instr->rs]; ^ ../machine/mipssim.cc:433:40: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[LoReg] = registers[instr->rs]; ^ ../machine/mipssim.cc:437:26: warning: array subscript has type ‘char’ [-Wchar-subscripts] Mult(registers[instr->rs], registers[instr->rt], TRUE, ^ ../machine/mipssim.cc:437:48: warning: array subscript has type ‘char’ [-Wchar-subscripts] Mult(registers[instr->rs], registers[instr->rt], TRUE, ^ ../machine/mipssim.cc:442:26: warning: array subscript has type ‘char’ [-Wchar-subscripts] Mult(registers[instr->rs], registers[instr->rt], FALSE, ^ ../machine/mipssim.cc:442:48: warning: array subscript has type ‘char’ [-Wchar-subscripts] Mult(registers[instr->rs], registers[instr->rt], FALSE, ^ ../machine/mipssim.cc:447:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = ~(registers[instr->rs] | registers[instr->rt]); ^ ../machine/mipssim.cc:447:46: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = ~(registers[instr->rs] | registers[instr->rt]); ^ ../machine/mipssim.cc:447:69: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = ~(registers[instr->rs] | registers[instr->rt]); ^ ../machine/mipssim.cc:451:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] | registers[instr->rt]; ^ ../machine/mipssim.cc:451:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] | registers[instr->rt]; ^ ../machine/mipssim.cc:451:67: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] | registers[instr->rt]; ^ ../machine/mipssim.cc:455:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = registers[instr->rs] | (instr->extra & 0xffff); ^ ../machine/mipssim.cc:455:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = registers[instr->rs] | (instr->extra & 0xffff); ^ ../machine/mipssim.cc:460:23: warning: array subscript has type ‘char’ [-Wchar-subscripts] (registers[instr->rs] + instr->extra), 1, registers[instr->rt])) ^ ../machine/mipssim.cc:460:64: warning: array subscript has type ‘char’ [-Wchar-subscripts] (registers[instr->rs] + instr->extra), 1, registers[instr->rt])) ^ ../machine/mipssim.cc:466:23: warning: array subscript has type ‘char’ [-Wchar-subscripts] (registers[instr->rs] + instr->extra), 2, registers[instr->rt])) ^ ../machine/mipssim.cc:466:64: warning: array subscript has type ‘char’ [-Wchar-subscripts] (registers[instr->rs] + instr->extra), 2, registers[instr->rt])) ^ ../machine/mipssim.cc:471:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rt] << instr->extra; ^ ../machine/mipssim.cc:471:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rt] << instr->extra; ^ ../machine/mipssim.cc:475:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rt] << ^ ../machine/mipssim.cc:475:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rt] << ^ ../machine/mipssim.cc:476:26: warning: array subscript has type ‘char’ [-Wchar-subscripts] (registers[instr->rs] & 0x1f); ^ ../machine/mipssim.cc:480:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] < registers[instr->rt]) ^ ../machine/mipssim.cc:480:48: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] < registers[instr->rt]) ^ ../machine/mipssim.cc:481:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = 1; ^ ../machine/mipssim.cc:483:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = 0; ^ ../machine/mipssim.cc:487:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (registers[instr->rs] < instr->extra) ^ ../machine/mipssim.cc:488:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = 1; ^ ../machine/mipssim.cc:490:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = 0; ^ ../machine/mipssim.cc:494:26: warning: array subscript has type ‘char’ [-Wchar-subscripts] rs = registers[instr->rs]; ^ ../machine/mipssim.cc:497:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = 1; ^ ../machine/mipssim.cc:499:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = 0; ^ ../machine/mipssim.cc:503:26: warning: array subscript has type ‘char’ [-Wchar-subscripts] rs = registers[instr->rs]; ^ ../machine/mipssim.cc:504:26: warning: array subscript has type ‘char’ [-Wchar-subscripts] rt = registers[instr->rt]; ^ ../machine/mipssim.cc:506:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = 1; ^ ../machine/mipssim.cc:508:25: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = 0; ^ ../machine/mipssim.cc:512:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rt] >> instr->extra; ^ ../machine/mipssim.cc:512:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rt] >> instr->extra; ^ ../machine/mipssim.cc:516:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rt] >> ^ ../machine/mipssim.cc:516:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rt] >> ^ ../machine/mipssim.cc:517:26: warning: array subscript has type ‘char’ [-Wchar-subscripts] (registers[instr->rs] & 0x1f); ^ ../machine/mipssim.cc:521:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp = registers[instr->rt]; ^ ../machine/mipssim.cc:523:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = tmp; ^ ../machine/mipssim.cc:527:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp = registers[instr->rt]; ^ ../machine/mipssim.cc:528:30: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp >>= (registers[instr->rs] & 0x1f); ^ ../machine/mipssim.cc:529:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = tmp; ^ ../machine/mipssim.cc:533:28: warning: array subscript has type ‘char’ [-Wchar-subscripts] diff = registers[instr->rs] - registers[instr->rt]; ^ ../machine/mipssim.cc:533:51: warning: array subscript has type ‘char’ [-Wchar-subscripts] diff = registers[instr->rs] - registers[instr->rt]; ^ ../machine/mipssim.cc:534:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (((registers[instr->rs] ^ registers[instr->rt]) & SIGN_BIT) && ^ ../machine/mipssim.cc:534:50: warning: array subscript has type ‘char’ [-Wchar-subscripts] if (((registers[instr->rs] ^ registers[instr->rt]) & SIGN_BIT) && ^ ../machine/mipssim.cc:535:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] ((registers[instr->rs] ^ diff) & SIGN_BIT)) { ^ ../machine/mipssim.cc:539:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = diff; ^ ../machine/mipssim.cc:543:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] - registers[instr->rt]; ^ ../machine/mipssim.cc:543:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] - registers[instr->rt]; ^ ../machine/mipssim.cc:543:67: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] - registers[instr->rt]; ^ ../machine/mipssim.cc:548:23: warning: array subscript has type ‘char’ [-Wchar-subscripts] (registers[instr->rs] + instr->extra), 4, registers[instr->rt])) ^ ../machine/mipssim.cc:548:64: warning: array subscript has type ‘char’ [-Wchar-subscripts] (registers[instr->rs] + instr->extra), 4, registers[instr->rt])) ^ ../machine/mipssim.cc:553:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:585:33: warning: array subscript has type ‘char’ [-Wchar-subscripts] value = registers[instr->rt]; ^ ../machine/mipssim.cc:588:58: warning: array subscript has type ‘char’ [-Wchar-subscripts] value = (value & 0xff000000) | ((registers[instr->rt] >> 8) & ^ ../machine/mipssim.cc:592:58: warning: array subscript has type ‘char’ [-Wchar-subscripts] value = (value & 0xffff0000) | ((registers[instr->rt] >> 16) & ^ ../machine/mipssim.cc:596:58: warning: array subscript has type ‘char’ [-Wchar-subscripts] value = (value & 0xffffff00) | ((registers[instr->rt] >> 24) & ^ ../machine/mipssim.cc:612:27: warning: array subscript has type ‘char’ [-Wchar-subscripts] tmp = registers[instr->rs] + instr->extra; ^ ../machine/mipssim.cc:644:55: warning: array subscript has type ‘char’ [-Wchar-subscripts] value = (value & 0xffffff) | (registers[instr->rt] << 24); ^ ../machine/mipssim.cc:647:53: warning: array subscript has type ‘char’ [-Wchar-subscripts] value = (value & 0xffff) | (registers[instr->rt] << 16); ^ ../machine/mipssim.cc:650:51: warning: array subscript has type ‘char’ [-Wchar-subscripts] value = (value & 0xff) | (registers[instr->rt] << 8); ^ ../machine/mipssim.cc:653:33: warning: array subscript has type ‘char’ [-Wchar-subscripts] value = registers[instr->rt]; ^ ../machine/mipssim.cc:675:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] ^ registers[instr->rt]; ^ ../machine/mipssim.cc:675:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] ^ registers[instr->rt]; ^ ../machine/mipssim.cc:675:67: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rd] = registers[instr->rs] ^ registers[instr->rt]; ^ ../machine/mipssim.cc:679:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = registers[instr->rs] ^ (instr->extra & 0xffff); ^ ../machine/mipssim.cc:679:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] registers[instr->rt] = registers[instr->rs] ^ (instr->extra & 0xffff); ^ g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../machine/translate.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../machine/network.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../machine/disk.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../threads/alarm.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../threads/kernel.cc ../threads/kernel.cc: In member function ‘void Kernel::Initialize()’: ../threads/kernel.cc:93:38: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] currentThread = new Thread("main"); ^ ../threads/kernel.cc: In member function ‘void Kernel::ThreadSelfTest()’: ../threads/kernel.cc:152:39: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] semaphore = new Semaphore("test", 0); ^ ../threads/kernel.cc: In member function ‘void Kernel::NetworkTest()’: ../threads/kernel.cc:208:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] char *data = "Hello there!"; ^ ../threads/kernel.cc:209:21: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] char *ack = "Got it!"; ^ In file included from ../threads/synchlist.h:49:0, from ../threads/kernel.cc:14: ../threads/synchlist.cc: In instantiation of ‘SynchList<T>::SynchList() [with T = int]’: ../threads/kernel.cc:158:20: required from here ../threads/synchlist.cc:26:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] lock = new Lock("list lock"); ^ ../threads/synchlist.cc:27:15: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] listEmpty = new Condition("list empty cond"); ^ ../threads/synchlist.cc: In instantiation of ‘void SynchList<T>::SelfTest(T) [with T = int]’: ../threads/kernel.cc:159:25: required from here ../threads/synchlist.cc:120:39: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] Thread *helper = new Thread("ping"); ^ g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../threads/main.cc ../threads/main.cc:59:8: warning: extra tokens at end of #endif directive [enabled by default] #endif TUT ^ In file included from ../threads/main.cc:41:0: ../lib/copyright.h:23:26: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] static char *copyright = "Copyright (c) 1992-1993 The Regents of the University of California. All rights reserved."; ^ ../threads/main.cc: In function ‘int main(int, char**)’: ../threads/main.cc:182:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] char *debugArg = ""; ^ g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../threads/scheduler.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../threads/synch.cc ../threads/synch.cc: In member function ‘void Semaphore::SelfTest()’: ../threads/synch.cc:138:39: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] Thread *helper = new Thread("ping"); ^ ../threads/synch.cc:141:35: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] ping = new Semaphore("ping", 0); ^ ../threads/synch.cc: In constructor ‘Lock::Lock(char*)’: ../threads/synch.cc:161:40: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] semaphore = new Semaphore("lock", 1); // initially, unlocked ^ ../threads/synch.cc: In member function ‘void Condition::Wait(Lock*)’: ../threads/synch.cc:250:43: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] waiter = new Semaphore("condition", 0); ^ g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../threads/thread.cc ../threads/thread.cc: In member function ‘void Thread::SelfTest()’: ../threads/thread.cc:430:43: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] Thread *t = new Thread("forked thread"); ^ g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../userprog/addrspace.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../userprog/exception.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../userprog/synchconsole.cc ../userprog/synchconsole.cc: In constructor ‘SynchConsoleInput::SynchConsoleInput(char*)’: ../userprog/synchconsole.cc:23:33: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] lock = new Lock("console in"); ^ ../userprog/synchconsole.cc:24:44: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] waitFor = new Semaphore("console in", 0); ^ ../userprog/synchconsole.cc: In constructor ‘SynchConsoleOutput::SynchConsoleOutput(char*)’: ../userprog/synchconsole.cc:79:34: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] lock = new Lock("console out"); ^ ../userprog/synchconsole.cc:80:45: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] waitFor = new Semaphore("console out", 0); ^ g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../filesys/directory.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../filesys/filehdr.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../filesys/filesys.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../filesys/pbitmap.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../filesys/openfile.cc g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../filesys/synchdisk.cc ../filesys/synchdisk.cc: In constructor ‘SynchDisk::SynchDisk()’: ../filesys/synchdisk.cc:30:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] semaphore = new Semaphore("synch disk", 0); ^ ../filesys/synchdisk.cc:31:38: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] lock = new Lock("synch disk lock"); ^ g++ -ftemplate-depth-100 -Wno-deprecated -g -Wall -fpermissive -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -DFILESYS_STUB -DRDATA -DSIM_FIX -DTUT -Dx86 -DLINUX -DCHANGED -m32 -c ../network/post.cc ../network/post.cc: In constructor ‘PostOfficeInput::PostOfficeInput(int)’: ../network/post.cc:155:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] messageAvailable = new Semaphore("message available", 0); ^ ../network/post.cc:162:43: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] Thread *t = new Thread("postal worker"); ^ ../network/post.cc: In constructor ‘PostOfficeOutput::PostOfficeOutput(double)’: ../network/post.cc:268:50: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] messageSent = new Semaphore("message sent", 0); ^ ../network/post.cc:269:44: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] sendLock = new Lock("message send lock"); ^ In file included from ../threads/synchlist.h:49:0, from ../network/post.h:34, from ../network/post.cc:20: ../threads/synchlist.cc: In instantiation of ‘SynchList<T>::SynchList() [with T = Mail*]’: ../network/post.cc:52:38: required from here ../threads/synchlist.cc:26:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] lock = new Lock("list lock"); ^ ../threads/synchlist.cc:27:15: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] listEmpty = new Condition("list empty cond"); ^ /lib/cpp -P -I../network -I../filesys -I../userprog -I../threads -I../machine -I../lib -Dx86 -DLINUX ../threads/switch.s > swtch.s as -o switch.o swtch.s swtch.s: Assembler messages: swtch.s:7: 错误: invalid instruction suffix for `push' swtch.s:9: 错误: invalid instruction suffix for `push' swtch.s:10: 错误: operand type mismatch for `call' swtch.s:11: 错误: operand type mismatch for `call' swtch.s:12: 错误: operand type mismatch for `call' swtch.s:14: 错误: invalid instruction suffix for `pop' Makefile:342: recipe for target 'switch.o' failed make: *** [switch.o] Error 1
最新发布
05-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值