the current work is related to SVN. Today, a small Program is written using the svn library, when Code is compiled, the compiler generates a warning: "Warning: 'svn _ client_ls2 'is deprecated (declared ".
SVN @ Linux-rwdx :~ /Objs/motadou> makeg ++ WebDAV. CPP-O WebDAV-I/home/SVN/apps/SVN/include/subversion-1-I/home/SVN/apps/neon/include/neon-I/home/SVN /apps/APR-util/include/apr-1-I/home/SVN/apps/APR/include/apr-1-I/home/SVN/apps/SQLite/include-I/home /SVN/apps/SSL/include/OpenSSL \-L/home/SVN/apps/SVN/lib-lsvn_client-1-lsvn_wc-1-lsvn_fs-1-lsvn_fs_fs-1-lsvn_fs_util-1-lsvn_ra-1-lsvn_ra_neon-1-lsvn_ra_local-1- lsvn_repos-1-lsvn_delta-1-lsvn_diff-1-lsvn_subr-1-L/home/SVN/apps/neon/lib-lneon-L/home/SVN/apps/APR-util/lib-laprutil-1-L/ home/SVN/apps/APR/lib-lapr-1-pthread/home/SVN/apps/SQLite/lib/libsqlite3.a-L/home/SVN/apps/SSL/lib-lssl- lcrypto-lzwebdav. CPP: In function 'int svn_list (handle &, const STD: string &) ': WebDAV. CPP: 120: Warning: 'svn _ client_ls2 'is deprecated (declared at/home/SVN/apps/SVN/include/subversion-1/svn_client.h: 4942) WebDAV. CPP: 120: Warning: 'svn _ client_ls2 'is deprecated (declared at/home/SVN/apps/SVN/include/subversion-1/svn_client.h: 4942)
View the declaration of the svn_client_ls2 function in the "/home/SVN/apps/SVN/include/subversion-1/svn_client.h" file, and find that this function previously had such a macro definition "svn_deprecated ". Continue tracing and find that svn_deprecated is defined as follows:
# Ifndef svn_deprecated # If! Defined (swigperl )&&! Defined (swigpython )&&! Defined (swigruby) # If defined (_ gnuc __) & (_ gnuc _> = 4 | (_ gnuc __= = 3 & _ gnuc_minor __> = 1 )) # define svn_deprecated _ attribute _ (Deprecated) # Elif defined (_ msc_ver) & _ msc_ver >=1300 # define svn_deprecated _ declspec (Deprecated) # else # define svn_deprecated # endif
Since then, I still don't understand the true meaning of the alarm. So I searched the internet for "_ attribute _ (Deprecated)" and found a prompt on the arm Website:
You can use the deprecated variable attribute to declare variables that are not recommended, without causing the compiler to issue any warning or error. However, warnings are generated for any access to the deprecated variable, but compilation is still performed. The warning indicates the location where variables are used and defined. This helps identify the reasons for not advocating the use of specific definitions.
for details, the warning originally meant: the svn_client_ls2 function is not recommended in the current library, A new function can replace it . Therefore, SVN developers use the "_ attribute _ (Deprecated)" compiler extension to prompt developers that the function has expired. Use the new function encoding as soon as possible.
to extend the declared variables or functions of the compiler, we need to understand:
1. if the variable or function is not used by a third-party developer, no warning or error occurs even if the developer uses a library containing the function to compile the code.
2. if the developer references a variable or function declared by "_ attribute _ (Deprecated)" in the Code, the compiler will prompt that the function has expired.